Skip to content

Commit

Permalink
Show timestamp and move number in 2048.py
Browse files Browse the repository at this point in the history
  • Loading branch information
nneonneo committed Mar 27, 2014
1 parent b316568 commit c4a5148
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion 2048.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def rungame(args):
gamectrl = Fast2048Control(ctrl)
# gamectrl = Keyboard2048Control(ctrl)

moveno = 0
start = time.time()
while 1:
state = gamectrl.get_status()
if state == 'ended':
Expand All @@ -92,11 +94,12 @@ def rungame(args):
time.sleep(3)
gamectrl.continue_game()

moveno += 1
board = gamectrl.get_board()
move = find_best_move(board)
if move < 0:
break
print "Recommended move:", movename(move)
print "%010.6f: Move %d: %s" % (time.time() - start, moveno, movename(move))
gamectrl.execute_move(move)

if __name__ == '__main__':
Expand Down

0 comments on commit c4a5148

Please sign in to comment.