import numpy as np
import random

import game as g
import hand_optimizer

game = g.PineappleGame1()

NUM_ITERS = 1000

utilities = []
for iter_num in xrange(NUM_ITERS):
  print "{:5} / {:5}".format(iter_num, NUM_ITERS), '\r',
  draw = random.sample(game.cards, 14)
  utilities += [hand_optimizer.optimize_hand([[], [], []], draw)]
print ''

utilities = np.array(utilities)
print "Average utility: {} +/- {}".format(np.mean(utilities), np.std(utilities) / np.sqrt(NUM_ITERS))
@@ -1,12 +1,28 @@
+import argparse%0A
 import numpy
@@ -83,16 +83,355 @@
 imizer%0A%0A
+parser = argparse.ArgumentParser(description='Simulate fantasyland like situations.')%0Aparser.add_argument('--num-games', type=int, default=1000,%0A                    help='number of games to play')%0Aparser.add_argument('--num-cards', type=int, default=14,%0A                    help='number of cards to be dealt')%0A%0Aargs = parser.parse_args()%0A%0A
 game = g
@@ -451,26 +451,8 @@
 e1()
-%0A%0ANUM_ITERS = 1000
 %0A%0Aut
@@ -487,25 +487,30 @@
  xrange(
-NUM_ITERS
+args.num_games
 ):%0A  pri
@@ -543,25 +543,30 @@
 er_num, 
-NUM_ITERS
+args.num_games
 ), '%5Cr',
@@ -601,18 +601,30 @@
 .cards, 
-14
+args.num_cards
 )%0A  util
@@ -819,15 +819,20 @@
 qrt(
-NUM_ITERS
+args.num_games
 ))

Add command line interface to vary num-games and num-cards.