tictactoe script - commented - may have pedagogical value

Steve D'Aprano steve+python at pearwood.info
Thu Sep 7 08:07:38 EDT 2017


On Thu, 7 Sep 2017 06:05 pm, Chris Angelico wrote:

> On Thu, Sep 7, 2017 at 5:11 PM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
>> 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.
> 
> That's all HTML is capable of. Without assistance, HTML is nothing
> more than layouts.

That's what I thought, but then Stefan introduced this as if it were a
refutation:

"Whenever someone yells at me, »HTML is not a programming language!«,
I show them the interactive tic-tac-toe by Flo Kreidler, written in
pure HTML"


but it turns out it isn't a refutation, its just a simple trick.


[...]
>> 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.
> 
> Correct; however, with something this small, the difference isn't
> significant. What, ultimately, is the difference between a
> live-rendered image and a static photo? 

A lot.

That's why it took significantly more than a century of technological
development to go from the first static photos to systems able to render
photo-realistic images. And we still can't do that rendering in real-time,
except for the simplest, least realistic images.

(The oldest surviving permanent photographic image dates back to 1827 or so.)

As a practical technique, naturally using a lookup table of pre-computed values
is a good solution to many problems. But you cannot say you are performing
general computation if *all* you do is a lookup.


> For the ability to brag that a 
> fully-playable game requires nothing more than HTML, I think this
> minor cheat is worth it. It's gimmicky and cute, rather than being any
> sort of "hey look, HTML is a programming language" thing.

Which is what I thought it was. I thought I had learned something new, but it
turned out I was right again :-(



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list