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

Commentary describing play resulting in a lucky goal by Liverpool

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

Video games

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

Pokemon

Limited number of keys for input
ascii3D

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

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).

See also our tabulated links to integer problems on the DelphiForFun website.

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
Adding HTML tags to keywords

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

Pathfinder

GASP

GASP

MatrixInverter

Many routines probably using WinGraph or SDL
Visual effect MovingBallWithParticles, BlendingEllipses, MultiDraw
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
Olympiad puzzle

The British Informatics Olympiad is the national computing competition for schools and colleges. You can download past papers from the problems page. For example, try Digit words from the 2009 BIO.

You can download the marking schemes too. The instruction to award a score of zero if a student gets a negative number of marks on any question suggests that the questions are not all that easy!

Many facilities including nested loops
Assorted challenges Many tutorials include suggestions for challenging tasks. For example, you can follow these links to the Experimenting sections for recursion, validating a postcode, linked lists, queues, sorting and searching, in-line assembler and inheritance. Many facilities including recursion, string manipulation routines
Programming - a skill for life!

Some great challenges for you to try!