コード例 #1
0
# DESCRIPTION of PLAYERS.
# weights[0] determines how important size of a piece is
# weights[1] determines how important maximizing the difference of my corners and opponent corners
# weights[2] decides how many of the best placements we choose to look ahead with
# weights[3] decides how important the score of the second move is
# weights[4] decides how important the score of the first move is

# <EDIT START
NUM_ITERATION = 20 
SAVE_FILE_NAME = "min_v_greedy_%d.json" % NUM_ITERATION 
DEBUG = False
# EDIT END/>

### RUN & SAVE ###
record_dicts = []

for i in range(NUM_ITERATION):
    print("################ Iteration %d ################" % (i+1) )

    # <EDIT START
    first   = Greedy("A", "Minimax(2,1)A", Minimax_Player, [2, 1, 5, 1, 1])
    second  = Player("B", "RandomB", Random_Player)
    third   = Greedy("C", "Greedy(2,1)C", Greedy_Player, [2, 1, 5, 1, 1])
    fourth  = Player("D", "RandomD", Random_Player)
    # EDIT END/>

    record_dicts += [T.run_test_all_general(first, second, third, fourth,DEBUG)]

T.save(record_dicts, SAVE_FILE_NAME)
コード例 #2
0
ファイル: merge.py プロジェクト: jeong242/blokus_python
import sys
import os
cwd = os.getcwd()
sys.path.insert(0, cwd + "/..")
import test_utils as T

# not random any more.
all_random = "all_random.json"
greedy_v_greedy_5 = "greedy[2,1]_v_greedy[2,1]_5.json"
greedy_v_greedy_15 = "greedy[2,1]_v_greedy[2,1]_15.json"
min_v_greedy_20 = "min[2,1]_v_greedy[2,1]_20.json"

FILENAME1 = greedy_v_greedy_5
FILENAME2 = greedy_v_greedy_15

loaded1 = T.load(FILENAME1)
loaded2 = T.load(FILENAME2)

T.save(loaded1 + loaded2, "greedy[2,1]_v_greedy[2,1]_20.json")
コード例 #3
0
ファイル: script_play.py プロジェクト: jeong242/blokus_python
import sys\nsys.path.insert(0, '/Users/minyoungjeong/Desktop/4511_project/Machine-Learning-Blokus-master')
import test_utils as T

result = T.run_test_all_random(True)
T.save([result], "test.json")
コード例 #4
0
# Run four random players.
NUM_ITERATION = 2

import sys
sys.path.insert(
    0,
    '/Users/minyoungjeong/Desktop/4511_project/Machine-Learning-Blokus-master')

import test_utils as T

record_dicts = []

for i in range(NUM_ITERATION):
    record_dicts += [T.run_test_all_random()]

T.save(record_dicts, "all_random.json")