diff --git a/board.py b/board.py index 5f438ae..6e9aeb1 100644 --- a/board.py +++ b/board.py @@ -185,6 +185,8 @@ class Board: # turn and then do something with the second die def calc_moves(board, face_value): + return quack.calc_moves(board, player, face_value) + idxs_with_checkers = Board.idxs_with_checkers_of_player(board, player) if len(idxs_with_checkers) == 0: return [board] @@ -271,39 +273,4 @@ class Board: @staticmethod def do_move(board, player, move): # Implies that move is valid; make sure to check move validity before calling do_move(...) - - def move_to_bar(board, to_idx): - board = list(board) - if player == 1: - board[25] -= player - else: - board[0] -= player - - board[to_idx] = 0 - return board - - # TODO: Moving in from bar is handled by the representation - # TODONE: Handle bearing off - - from_idx = move[0] - #print("from_idx: ", from_idx) - to_idx = move[1] - #print("to_idx: ", to_idx) - # pdb.set_trace() - board = list(board) # Make mutable copy of board - - # 'Lift' checker - board[from_idx] -= player - - # Handle bearing off - if to_idx < 1 or to_idx > 24: - return tuple(board) - - # Handle hitting checkers - if board[to_idx] * player == -1: - board = move_to_bar(board, to_idx) - - # Put down checker - board[to_idx] += player - - return tuple(board) + return quack.do_move(board, player, move)