4 ms·
In the 90s I wrote a Tic-Tac-Toe for Casio graphical calculators (fx7500G). The main constraint was the code size, so I did heaving golfing. To store the game
by dolmen 3y ago
In the 90s I wrote a Tic-Tac-Toe for Casio graphical calculators (fx7500G).
The main constraint was the code size, so I did heaving golfing.
To store the game state I did use 3 bits for each cell (0=empty, 1=X, 4=O), total 27 bits. That structure allowed to conveniently check if a win state was reached by multiplying the 3 cells values of the column/row/diagonal of the last move (multiplication required less code bytes than addition). 111=1 or 444=64 were winning states.
However I have a formula in the code that I fail to remember what was its use:
15.5I-2.5I²-20
Full source is here: https://web.archive.org/web/20010517135352/http://www.multimania.com/dolmen/productions/casio/MORPION.TXT https://web.archive.org/web/20010517135352/http://www.multim...