Example #1
0
def trace(game):
    '''Trace the state of the game and record it.'''

    state = {
        'problemId': game.problem_id,
        'seed': game.seed,
        'boardState': game.render_grid(),
        'history': game.history[:],
        'gameEnded': game.game_ended,
        }
    game.trace.append(state)
def display(game):
  sys.stdout.write("\x1b\x5b\x48\x1b\x5b\x4a")
  sys.stdout.write(game.render_grid())
  sys.stdout.write('\nCurrent move score: {}\n'.format(game.move_score))
  sys.stdout.write('Current unit:\n')
  sys.stdout.write(str(game.current_unit))