""" A simple program that will import your tests and run them all! Be sure you include tests for your other modules like cells and player! Usage: python3 test_all.py """ import subprocess from test_game import run_tests as test_game from test_grid import run_tests as test_grid from test_parser import run_tests as test_parser print("###########################") print("### Running unit tests! ###") print("###########################\n") test_game() test_grid() test_parser() # Run the e2e script subprocess.call(['./test_e2e.sh'])
cnt = 1 - cnt for state in game_states: move, situation = state[0], tuple(state[1:]) strategy_record_scr[situation] += score(move, win_flag) strategy_record_tot[situation] += 1 """ for state in game_states: move, choices, KNOWNS, HMAID, deck, drop = state situation = tuple(state[1:]) strategy_loaded[(str(choices),str(KNOWNS),HMAID,str(deck))][drop] = strategy_record_scr[situation]/strategy_record_tot[situation] """ if games_count % 100000 == 0: num_games = 10000. scoringA, scoringB = test_game( int(num_games), strategy_loaded, "eps-greedy") print "=" * 30 print "after #", games_count, "games..." print "length of dict =", len(strategy_loaded.keys()) print "-" * 20 print "A is the first player:" for win_flag in scoringA: print win_flag, scoringA[win_flag] / num_games print "-" * 20 print "B is the first player:" for win_flag in scoringB: print win_flag, scoringB[win_flag] / num_games # see strategy sheet after several games #print '\n','='*20,'\n','strategy_record... '