40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
from board import Board
|
|
|
|
class Human:
|
|
def __init__(self, sym):
|
|
self.sym = sym
|
|
|
|
def switch(self,cur):
|
|
return -1 if cur == 1 else 1
|
|
|
|
def get_sym(self):
|
|
return self.sym
|
|
|
|
def do_move(self, board, roll):
|
|
print(Board.pretty(board))
|
|
print("Human: ",roll,"-"*20)
|
|
print(Board.find_legal_moves(board,self.sym,roll[0]))
|
|
|
|
print("What to do with the first roll?")
|
|
cmds_1 = input().split(",")
|
|
|
|
while not Board.is_move_valid(board, roll[0], self.sym, cmds_1):
|
|
print("Invalid move, try again.")
|
|
cmds_1 = input().split(",")
|
|
|
|
new_board = Board.move_thing(board, self.sym, int(cmds_1[0]), int(cmds_1[1]))
|
|
|
|
|
|
print(Board.pretty(board))
|
|
print(Board.find_legal_moves(new_board, self.sym,roll[1]))
|
|
print("What to do with the second roll?")
|
|
cmds_2 = input().split(",")
|
|
while not Board.is_move_valid(new_board, roll[1], self.sym, cmds_2):
|
|
print("Invalid move")
|
|
cmds_2 = input().split(",")
|
|
|
|
|
|
return Board.move_thing(new_board, self.sym, int(cmds_2[0]), int(cmds_2[1]))
|
|
|
|
|