from bots.rdeep import rdeep from bots.bully import bully from bots.ml_advanced import ml_advanced from bots.ml import ml from bots.alphabeta import alphabeta #Pick the features of which bot you want to use for training the model: #from bots.ml.ml import features from bots.ml_stripped.ml_stripped import features GAMES = 100000 # Which phase the game starts in PHASE = 2 # The player we'll observe player = alphabeta.Bot() #player = rdeep.Bot() #player = ml_advanced.Bot() data = [] target = [] for g in range(GAMES): # Randomly generate a state object starting in specified phase. state = State.generate(phase=PHASE) state_vectors = [] while not state.finished():
""" Check that the minmax bot and alpha beta bot return the same judgement, and that alphabeta bot is faster """ from api import State, util import random, time from bots.alphabeta import alphabeta from bots.minimax import minimax REPEATS = 3 MOVES = 2 DEPTH = 4 ab = alphabeta.Bot(randomize=False, depth=DEPTH) mm = minimax.Bot(randomize=False, depth=DEPTH) mm_time = 0 ab_time = 0 for r in range(REPEATS): # Generate a starting state state = State.generate(10, phase=2) # Do a few random moves for m in range(MOVES): state = state.next(random.choice(state.moves())) # Ask both bots their move