Chris Hinsley <chris.hins...@gmail.com> wrote: >New to Python, which I really like BTW. > >First serious prog. Hope you like it. I know it needs a 'can't move if >your King would be put into check' test. But the weighted value of the >King piece does a surprising emergent job.
It looks a little like a C program ported line-by-line to Python. For example, in Python, there's no reason not to keep the board as an 8x8 array instead of a 64-element list. That by itself would make the code easier to read. It would also let you replace this: for row in range(8): for col in range(8): with the more Pythonic: for row in board: for cell in row: I would probably replace the piece_type function with a map that maps the piece number directly to the piece -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list