Skip to content

Commit

Permalink
Added average total game time to final output
Browse files Browse the repository at this point in the history
Since adding per bot timing will touch 3 files (game, run, gamestate) and a ton of classes, I wanted to add some simple timing for comparisons.
  • Loading branch information
ramk13 committed Sep 9, 2014
1 parent 7169989 commit 8633157
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rgkit/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import random
import os
import sys
import time

try:
imp.find_module('rgkit')
Expand Down Expand Up @@ -376,8 +377,11 @@ def main():
runner = run_concurrently
else:
runner = lambda _args: Runner.from_command_line_args(_args).run()
scores = runner(args)

start_time = time.time()
scores = runner(args)
total_time = time.time() - start_time

if args.quiet >= 3:
unmute_all()
p1won = sum(p1 > p2 for p1, p2 in scores)
Expand All @@ -386,6 +390,7 @@ def main():
if args.heatmap:
print_score_grid(scores, args.player1, args.player2, 26)
print [p1won, p2won, args.count - p1won - p2won], '-', avg_score
print '%5.2f s per game' % (total_time/args.count)


if __name__ == '__main__':
Expand Down

0 comments on commit 8633157

Please sign in to comment.