Example #1
0
 def __init__(self):
     self.GenMoveInstance = genmoves.GenMoves()
     self.specialStaticEval = None
     self.prune = False
     self.maxPly = None
     self.setMaxPly()
     self.states = 0
     self.cutoffs = 0
Example #2
0
 def __init__(self):
     self.GenMoveInstance = genmoves.GenMoves()
     self.se_func = None
     self.usePrune = True
     self.stateExplored = 0
     self.cutoff = 0
     self.die1 = 1
     self.die2 = 6
     self.MaxDepth = 3
Example #3
0
 def __init__(self):
     self.GenMoveInstance = genmoves.GenMoves()
     self.states = 0  # number of states explored
     self.cutoffs = 0  # number of states that is being cutoff
     self.maxply = 3  # max depth
     self.MIN = -100000
     self.MAX = 100000
     self.prune = True  # whether to use alpha-beta pruning
     self.dict = {
     }  # dictionary that keep tracks of the best value (key) and its move
Example #4
0
    def __init__(self):
        self.GenMoveInstance = genmoves.GenMoves()
        self.maxply = 2
        self.MIN = -100000
        self.MAX = 100000
        self.dict = {
        }  # dictionary that keep tracks of the best value and its move
        self.dice = [
        ]  # possible combination of two dices, each has the probability of 1 / 36
        self.prob = 1 / 36

        for i in range(1, 7):
            for j in range(1, 7):
                self.dice.append((i, j))
Example #5
0
 def __init__(self):
     self.GenMoveInstance = genmoves.GenMoves()
     self.specialStaticEval = None
     self.maxPly = None
     self.setMaxPly()
Example #6
0
 def __init__(self):
     self.GenMoveInstance = genmoves.GenMoves()
     self.MaxDepth = 3
     self.uniform = True
     self.die1 = 0
     self.die2 = 0
Example #7
0
 def __init__(self):
     self.GenMoveInstance = genmoves.GenMoves()
Example #8
0
So we might get (8, 14) if there were two checkers that moved, which is the opposite
of what we wanted. Additionally, in this case specifically, the second checker at 8
could be the same checker as the first! 7 goes to 8, then goes to 14. So with this case
(but not the other!), the checker at 7 could've have moved twice. So '7,8' with [1,6]
does not require 2 distinct checkers, while '8,7,r' with [1,6] does.
So to handle 'reverse', be sure to flip dice values, NOT checker positions.

1. There is duplicate methods in this class and in genmoves.py. Some of the methods
in genmoves.py do not seem to be the finished versions (as they were slightly different
from the original code in this method), but I don't know which to keep.
"""

from game_engine import genmoves
from game_engine.boardState import *
import copy
GENMOVES_INSTANCE = genmoves.GenMoves()
DONE = False

# Below are the agents used in "Play Offline"
# To change, simply add an import and change p1 or p2 to desired Agent
from agents import randomAgent, SkeletonAgent, backgammon_dsbg, backgammon_ssbg
##agent1 represents the white checkers and agent2 the red checkers
agent1 = backgammon_ssbg.BackgammonPlayer()
agent2 = SkeletonAgent.BackgammonPlayer()

DETERMINISTIC = False  # deterministic version: dice are loaded to give 1 and 6
# stochastic version (DETERMINISTIC = false): dice are rolled normally.


def run(white_player, red_player, max_secs_per_move, deterministic,
        print_to_console, initial_state):