How would I do this?

Ian Kelly ian.g.kelly at gmail.com
Fri Jul 26 06:02:18 CEST 2013


On Thu, Jul 25, 2013 at 9:40 PM,  <h4ck3rpr0n3 at gmail.com> wrote:
> Thank you for the quick reply. Unfortunately I'm still a little confused... How might I implement that into my current code?

Where you print spaces indicating an empty space, you need to look up
the current square in the board data structure to see what is
contained there (whether it's an empty space or not) and print it
accordingly.

I strongly recommend that you work out how to print the board using
nested for loops instead of all those individual print statements.
The result will be more compact, easier to work with, and less
error-prone.  The basic skeleton should look something like this:

for row in range(8):
    for column in range(8):
        print(board[row][column])

Which you'll need to embellish with the row and column dividers and labels.



More information about the Python-list mailing list