This is an attempt to see how small a pure HTML playable TicTacToe game can be. The first script (ttt.py
) generates a 560KB HTML file.
- The game is playable at https://pablo.rauzy.name/dev/ttt.html
I made it in reaction to this Hacker News post: Implementing Tic Tac Toe with 170MB of HTML – No JavaScript or CSS, because my reaction to "170MB" was "wait, WAT?".
The second script (ttt_smaller.py
) is an attempt to go further, by shortening IDs to maximum 2 chars rather than using 9 characters for full board descriptions as IDs. It does so by using a custom base74, because 74 + 74 × 74 = 5550 which is just above the 5478 game states that have to be represented.
This optimization allows to get down to 412KB, that is a saving of 148Ko, i.e., a 26% size-reduction!