Computing: Free Pascal Programming

Programming Home   Home   Contact

Simple Snake game (snake).


This program is obsolete! Please, use Snake2 (GUI application with exactly the same features) instead.

Description: Very simple Snake game. Usage of cursor keys to move the snake, which grows by eating meats (blue meats grow the snake by 1 element; cyan meats have no effect) and dies when hitting rocks (red). A "round" is started by pressing F10; all meats, including the cyan ones, must be eaten before you may pass to the next round (the sheat key CTRL+F12 allows you to skip eating cyan meats if all blue meats have been eaten). During snake movement, F10 pauses the game; press it again to continue the game.

Issue: There is a little inconveniant when running this program on Windows 10: Windows 10 Command Prompt is not fixed size but fully resizable as any other program window, the snake game window is only partially displayed when the program starts and the window has to be manually resized. To avoid doing this at each program execution, create a fixed size window shortcut, as described in the readme file, included in the .zip.

Free Pascal features: Usage of the Crt unit: command line windows; display at a given position within those windows; catching the keyborad key pressed. Complex Pascal data structures.

Screenshot:

Simple text-mode Snake game