tictactoe script - commented - may have pedagogical value

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Sep 7 03:11:37 EDT 2017


On Thu, 07 Sep 2017 01:45:01 +0000, Stefan Ram wrote:

> Steve D'Aprano <steve+python at pearwood.info> writes:
>>web.archive.org/web/20040428174214/http://www.geocities.com/
flo_kreidler/tictactoe.html
>>I am intrigued by the (alleged?) HTML version of tic-tac-toe. Can
>>somebody explain what it is doing and how it works?
> 
>   If you have Web access, you can paste the above archive-org URI ending
>   into the address bar of your Web browser to play the game and then
>   read the source code.
> 
>   To be clear, what you would have to paste into the address bar of a
>   Web browser is this line:
> 
> web.archive.org/web/20040428174214/http://www.geocities.com/
flo_kreidler/tictactoe.html
> 
>   (If this is not possible or not working, please let me know.
>   I then would also be willing to explain it in the Usenet.)

Thank you for the explanation Stefan, but I do know how to use a browser.

What I didn't know is how the HTML works. I thought it was actually doing 
some computation, but it seems like its just jumping to pre-rendered tic-
tac-toe grids.

So if we start with the following empty grid (best viewed with a 
monospaced font):


┌──┬──┬──┐
│  │  │  │
├──┼──┼──┤
│  │  │  │
├──┼──┼──┤
│  │  │  │
└──┴──┴──┘

and you click in the centre square, it jumps to the pre-rendered



┌──┬──┬──┐
│X │  │  │
├──┼──┼──┤
│O │O │X │
├──┼──┼──┤
│  │  │  │
└──┴──┴──┘


I don't know why it places *two* pairs of crosses and naughts instead of 
one. Maybe the page is broken.

But anyway... it doesn't seem to me that the page is doing any 
computation using HTML. It's more like a book listing a table of primes. 
The book hasn't done any computation, and we wouldn't say that this is 
proof that pieces of paper are capable of programming.




-- 
Steven D'Aprano
“You are deluded if you think software engineers who can't write 
operating systems or applications without security holes, can write 
virtualization layers without security holes.” —Theo de Raadt



More information about the Python-list mailing list