fork download
  1. import collections
  2.  
  3. NONE = 0
  4. BLACK = 'B'
  5. WHITE = 'W'
  6.  
  7. BOARD_COLUMNS = 10 #int(input('How many board columns? '))
  8. BOARD_ROWS = 10 #int(input('How many board rows? '))
  9.  
  10. class OthelloGameState:
  11.  
  12. def _new_game_board():
  13. board = []
  14. for col in range(BOARD_COLUMNS):
  15. board.append([])
  16. for row in range(BOARD_ROWS):
  17. board[-1].append(NONE)
  18. return board
  19.  
  20. def print_board(board):
  21. for col in range(BOARD_COLUMNS):
  22. print(' '.join([str(board[col][row]) for row in range(BOARD_ROWS)]))
  23.  
  24. board = _new_game_board()
  25. print_board(board)
  26.  
Success #stdin #stdout 0.01s 9080KB
stdin
Standard input is empty
stdout
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0