Plays a game of noughts and crosses (R.W. Payne).
Options
PLAY = string token |
Which symbol to play (noughts , crosses ); default * sets this by a question when you run the procedure |
DIFFICULTY = scalar |
Level of difficulty, either 0, 1, 2 or 3; default * sets this by a question when you run the procedure |
SEED = scalar |
Seed for the random numbers used by Genstat to select its choice of squares; default 0 |
Description
Nought and crosses (or tic-tac-toe) is a game where two players enter symbols alternately onto a three-by-three grid of squares. The first player enters crosses, and the second player enters noughts. The aim is to fill a row with your own symbol, either vertically, horizontally or diagonally.
The procedure first asks you whether you want to play with noughts or crosses. You can then select a level of difficulty, ranging from zero (where Genstat selects its squares at random) to three (where it aims to take an optimum strategy). The squares are displayed by the Genstat graphics viewer, and your choices are selected from a dialog displayed by the QDIALOG
directive. (So you should ensure that these are both viewable during the game.) You can avoid these questions by setting the PLAY
and DIFFICULTY
options.
The SEED
option specifies a seed for the random numbers that are used by Genstat to choose its squares. The default value of zero continues an existing sequence of random numbers if any have already been used in the current Genstat job, or obtains a random seed using the system clock if none have been used already.
Options: PLAY
, DIFFICULTY
, SEED
.
Parameters: none.
See also
Procedures: BINGO
, LIFE
, FRUITMACHINE
.
Example
CAPTION 'NOUGHTSANDCROSSES example',\ '(To be played while running Genstat interactively.)'; \ STYLE=meta,plain NOUGHTSANDCROSSES