from cup import Cup from board import Board import random class Bot: def __init__(self, sym): self.cup = Cup() self.sym = sym def roll(self): print("{} rolled: ".format(self.sym)) roll = self.cup.roll() print(roll) return roll def switch(self,cur): return -1 if cur == 1 else 1 def get_sym(self): return self.sym def do_move(board, roll): print(Board.pretty(board)) print(Board.find_legal_moves(board, self.sym, roll[0])) moves_1 = Board.find_legal_moves(board, self.sym,roll[0]) move = random.choice(moves_1) print("{} was picked as move".format(move)) new_board = Board.move_thing(self.sym, int(move[0]), int(move[1])) print(Board.pretty(new_board)) print(Board.find_legal_moves(new_board, self.sym, roll[1])) moves_2 = Board.find_legal_moves(new_board, self.sym,roll[1]) move = random.choice(moves_2) print("{} was picked as move".format(move)) return Board.move_thing(new_board, self.sym, int(move[0]), int(move[1]))