First attempt at a Python prog (Chess)

Joshua Landau joshua.landau.ws at gmail.com
Fri Jul 5 03:33:04 CEST 2013


Just a minor suggestion:

def display_board(board):
  print '  a   b   c   d   e   f   g   h'
  print '+---+---+---+---+---+---+---+---+'
  for row in range(8):
      for col in range(8):
          piece = board[row * 8 + col]

          if piece_type[piece] == WHITE:
            print '| \x1b[31;01m%c\x1b[39;49;00m' % board[row * 8 + col],

          else:
            print '| \x1b[34;01m%c\x1b[39;49;00m' % board[row * 8 + col],

      print '|', 8 - row

      print '+---+---+---+---+---+---+---+---+'



More information about the Python-list mailing list