tictactoe script - commented - may have pedagogical value
Ian Kelly <ian.g.kelly at gmail.com> writes:
> On Thu, Sep 7, 2017 at 2:05 AM, Chris Angelico <rosuav at gmail.com> wrote:
>> On Thu, Sep 7, 2017 at 5:11 PM, Steven D'Aprano
>>> I don't know why it places *two* pairs of crosses and naughts instead of
>>> one. Maybe the page is broken.
>> I think it is, as part of being on the Internet Archive. To get a
>> working version of the game, you may need to download it locally and
>> clean it up a bit.
> I was also very confused at first. I found that you need to hide the
> Internet Archive header because it covers the current board. It is
> also surprising in that the player's move is recorded with 'O' despite
> going first, which is contrary to the conventions of the game.
Yes, the fact that it's archived is annoying. I thought it was a
neat-enough idea to be worth doing cleanly, so I had a go:
The HTML is obviously generated by a program, and one can generate lots
of variations (even ones that will loose some games) but that can't be
done in HTML -- the complete, fixed, tree of accessible positions must
be there in the page before play starts.
(I know this is an old thread now, but Real Life got in the way of
programming as it so annoyingly does sometimes.)