A memory testing game in the terminal

The following script is a memory testing game that can be played on the terminal.

Save the script as
Give it execute permissions

execute it

It will display a menu, prompting you to select either the level or help for the game.

Enter the number of your choice to make the selection.
If you enter 2, medium level will be selected. It will display a matrix of 3 X 3 characters as shown below.

Easy level displays a matrix of 2 x 2
Hard level displays a matrix of 4 x 4

The matrix will be visible for 5 seconds with in which try to remember all the characters and their locations.
After 5 seconds the screen will be cleared.
Then you will be prompted to enter any of the characters randomly by displaying "X" at the corresponding cell

3 wrong answers per character are allowed after which the game gets over and the actual matrix will be displayed again.

Follow by Email