[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版

(yzsuai) #1

larger boards and more complex games, PyToe’s move selection algorithms become
even more useful.


PyToe Source Code (External)


PyToe is a big system that assumes some AI background knowledge and doesn’t really
demonstrate anything new in terms of GUIs. Moreover, it was written for Python 2.X
over a decade ago, and though ported to 3.X for this edition, some of it might be better
recoded from scratch today. Partly because of that, but mostly because I have a page
limit for this book, I’m going to refer you to the book’s examples distribution package
for its source code instead of listing it here. Please see these two files in the examples
distribution for PyToe implementation details:


PP4E\Ai\TicTacToe\tictactoe.py
A top-level wrapper script


PP4E\Ai\TicTacToe\tictactoe_lists.py
The meat of the implementation


Figure 11-25. PyToe thinking its way to a win


PyToe: A Tic-Tac-Toe Game Widget | 763
Free download pdf