Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A very long time ago I used the idea that there aren't actually that many possible tic-tac-toe boards to make an HTML player that is just static web pages

https://www.craig-wood.com/nick/oxo2d/

I generated this with a C program that tried to minimise the number of boards. There are 427 pages including the index.

This has been through quite a few revisions of my website and I lost the source to the C program so it remains a historical artifact only!




Since your C is lost here's Python code in an old article of mine: https://codewords.recurse.com/issues/four/the-language-of-ch... -- at least it gave the same number 427.

(About halfway down the page. It's as an example application of binary decision diagrams.)


Totally lost when you use python to define a domain specific language. Cannot get that most quoted paper and its idea. I wonder whether a lisp based one would be better. Please no C as well.


Sorry, the article was finished in a bit of a hurry. (Not sure what you mean about a domain specific language.) Maybe if the writing's too bad, the tic-tac-toe code might still be readable, in the linked repo https://github.com/darius/mccarthy-to-bryant (tictactoe.py and ttt_*). Python 2 (I said it was old).


I read your comment a few times and I have no idea what you are are trying to say. Can you explain?


“Something something only use programming languages I like.”


There's a book version of tic tac toe

Every page is a grid state and each cell contains the number of the page you're supposed to go to if you pick this cell


Oh man. This brought back memories. Back in 2007, I did this by embedding clickable boards in Reddit comments, with all the comments linked together. The idea was "playable tic-tac-toe inside Reddit comments". Reddit had to kill my account because the process doing comment indexing was blowing up.

But, hey, Steve Huffman sent me a Reddit sticker!


Seems appropriate given that a Huffman code is a compression strategy.


That reminds me of a former coworker who wrote a paperback version of the game Nim (the math game where you remove sticks). It worked like a choose your own adventure where each possible move had a page number to jump to.


Is there an inaccuracy for https://www.craig-wood.com/nick/oxo2d/b2/ ?

I believe the optimal response to:

    X . .
    . O .
    . . .
Should be

    X . .
    . O .
    . . X
Which offers a reasonable opportunity for "O" to mess up by choosing a corner. But instead your script plays

    X X .
    . O .
    . . .
Which guides the human player to reflexively counter accurately without thinking.


The immediate threat offers the opponent 5/6 losing moves, whereas yours offers only 2/6 losing moves. The rationale is quite similar to your choice of the initial corner move rather than center: there are 7/8 losing responses to turn 1 corner, and only 4/8 losing responses to turn 1 center. But you'll probably get more humans to pick a losing side response to center than pick a losing non-center response to corner.


> The immediate threat offers the opponent 5/6 losing moves, whereas yours offers only 2/6 losing moves.

This would be relevant if humans made their choice with a significant amount of randomness. But I argue that in this specific situation, very nearly every human will play to block the obvious threat.

I believe humans will be more likely to pick one of the two losing moves in the slightly more abstract/delayed threat scenario, than they would be to pick one of the 5 losing moves in the immediate threat scenario.


Yes, I believe this too.

I also believe humans are more likely to pick one of the 4/8 losing moves if you open center than one of the 7/8 losing moves if you open corner, though.


Ah, this clarifies your other point above. Thank you!


The game is playing a minimax strategy, which means if you go first it will at least draw, and if it goes first it will never lose.


Minimax seems logical on its face... but it costs nothing to slightly increase % chance of a win. And wins have some value over draws.


There is a tic-tac-toe system that learns to play using reinforcement learning built of matchboxes. Designed in 1961. https://en.wikipedia.org/wiki/Matchbox_Educable_Noughts_and_...


Interesting. Only 304 unique permutations so 9 bits is more than anyone would ever need for a tic-tac-toe state?


This is a great example of how you can trade time for space. There’s no reason you couldn’t do the same thing for chess, except it would take, er, quite a bit of disk space…


For something slightly more practical here's a printable PDF representation of googolplex: http://www.googolplexwrittenout.com/


I remember that 'idlewords once ran out of disk space on his server because a Pinboard user bookmarked some page that had written out a very large number (googolplex or similar) and the archived HTML was something like 50 GB or so :)

(I don’t remember the exact details now so take it with a grain of salt.)


there are even more possible variations of chess games than there are atoms in the observable universe.


My favourite "big but comprehensible generation number" is the count of unique shuffles of a standard deck of 52 cards.

(this is my best recollection of the "this is how insane it is" story, numbers may be slightly off)

Iterate through a billion possible shuffles a second and every yearly anniversary, take a 1M pace around the equator. When you get back to your starting point (after 40,075 years), take 1cc out of the Pacific Ocean.

When the ocean is empty, put one A4 piece of 0.05mm paper on a pile. Now you start filling the ocean 1cc every circumnavigation. When it's full, A4 piece of paper on the pile. etc.

By the time you exhaust the list of shuffles, the pile will be 188 light years tall.


Yeah, I'd definitely have to delete some old emails.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: