# Ideas for Programs

Suggestions for programs for practising various facilities of the Pascal language are tabulated below. Most can be used to incorporate procedures, functions and validation. The table is intended to give you ideas for programs. Please let us know if you have ideas of your own that work out well. See the following page for many other suggestions with links to further details and solutions on the DelphiForFun website.

Program Type Examples Pascal facilities practised
Conversion

Pounds to kilos
Miles per gallon to km per litre
Seconds per 100m to minutes per mile

Readln, writeln, assignment, arithmetic operators +, -, /, *, DIV and MOD
Number test

Score out of 10 for ten random additions
Choice of addition, subtraction, multiplication and division to be tested

Random numbers, arithmetic operators, if statements, case statement (for menu)
Money selection Calculate minimum number of notes and coins (£20, £10, £5, £2 and £1) to make up an amount supplied by the user. Integer division: DIV and MOD.
Simulation game

Maze e.g. MazeOnCube, Mazer, CrazyMaze
Horse racing with odds and simulated betting e.g. Betting
Football or hockey game outputting e.g. corners, free kicks, shots, saves, misses, goals

Football simulation

Random numbers, arrays, case statements
Card game Pontoon, snap, knockout whist Random numbers, arrays of records, loops
Video game Platform, first person shooter

Video games

Routines in WinGraph, SDL or Smart Pascal canvas
Game with restriction Limited units e.g. graphics using only the Crt unit

Pokemon

Limited number of keys for input

ascii3D

Limited number of lines of code and/or characters as exemplified in the following section (Mini-Challenges)
Routines in the Crt unit
Other game Hangman, noughts and crosses (tic tac toe), snakes and ladders, rock-paper-scissors, Risk, battleships

Battleships

Arrays, selection, iteration
Integer activity

Find the nth prime number. Find the nth palindrome number. Find prime numbers that are also palindrome numbers.

Convert a denary number supplied by the user to a Roman numeral. (Choose an upper limit for the number according to ability and time available).

Nested loops, DIV, MOD, ReverseString
String handling (using StrUtils)

Adding an even parity bit to a 7-bit string
Extracting surname and forename from full name
Validating dates and postcodes

String as array of char, LeftStr, RightStr, MidStr, Pos, StrToInt, IntToStr, Delete
Database Club membership, stock control for a small business, music collections, data for the common elements Files, arrays of records, searching, sorting, string grids and many other components
Educational Map-related, calculations, Computing

Pathfinder

GASP

MatrixInverter

Many routines probably using WinGraph or SDL
Visual effect MovingBallWithParticles, BlendingEllipses, MultiDraw

MultiDraw

Routines in WinGraph or SDL
Encryption and hiding messages Examples of encryption on this website include Peter Hearnshaw's Encrypt, a demonstration and using MMX for encryption. For a variety of encryption methods see Cipher Tools. Alternatively, you may want to try hiding a message in a picture.

Your school might like to enter the next annual University of Southampton National Cipher Challenge.

Files, arrays, selection, iteration, Chr, Ord, in-line assembler, MMX
Maths problem Our Links page describes Project Euler, which is an excellent place to start looking for problems and solutions. Many facilities including nested loops