tictactoe script - commented - may have pedagogical value

Chris Angelico rosuav at gmail.com
Thu Sep 7 08:21:58 EDT 2017


On Thu, Sep 7, 2017 at 10:07 PM, Steve D'Aprano
<steve+python at pearwood.info> wrote:
> 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.

Oh right. Yep. You're absolutely right that it's not a refutation -
though it is somewhat cool, like when I first met some of the HTML5
and CSS3 features that take over jobs that traditionally have been
done with JavaScript. And there's still more to do in that area -
check out "position: sticky", for instance.

>> 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.

Right, exactly - but my point is that the end result is often
indistinguishable. How do you calculate the sine of an angle? You
evaluate an infinite series until you're satisfied with your
accuracy... or you look up a table of sines. I learned how to use a
four-figure table in my school years, but learning how to actually
calculate them was never important.

>> 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 :-(

Yep. :-(

ChrisA



More information about the Python-list mailing list