tictactoe script - commented - may have pedagogical value

Ian Kelly ian.g.kelly at gmail.com
Thu Sep 7 10:16:31 EDT 2017


On Thu, Sep 7, 2017 at 6:21 AM, Chris Angelico <rosuav at gmail.com> wrote:
> On Thu, Sep 7, 2017 at 10:07 PM, Steve D'Aprano
> <steve+python at pearwood.info> wrote:
>> 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.

If this were a Python program using a tree of pre-computed states and
merely selecting between child nodes based on player input as opposed
to actively determining the best move for the current state, would you
also argue that that is not programmed?

I'm reminded of a fully analog dogfight simulator I once played. All
there was to it was a red book and a blue book for the two players.
Each player takes one of the books and turns to page 1, which shows an
illustration of a heads-up display with the enemy jet somewhere in
view and a radar display and other pertinent information. Each player
decides how they will react, and then the system tells each player
which page to turn to. Effectively, it's a two-player choose your own
adventure; or from another perspective, a state machine with two
inputs. On paper, would you assert that this state machine is not
programmed, yet put it too into a Python program and suddenly it is?

Nobody would claim that Babbage's difference engine was capable of
general computation, yet we can still talk about "programming" it in
its operation. It seems to me that HTML is in a similar position.



More information about the Python-list mailing list