示例#1
0
    def calculate_moves(self, dices: Die, board) -> [(int, int)]:
        self.items[Items.CURRENT_PLAYER_NAME].set(self.name)
        self.items[Items.CURRENT_PLAYER] = self
        self.items[Items.CURRENT_DIE].set(str(dices.get_roll()))
        self.uiBoard.draw_game_state(board)

        possible_moves = generate_moves(self, dices, board)
        moves = []
        if possible_moves:
            for i in range(len(possible_moves[0])):
                self.items[Items.NEXT_PLAYER_BUTTON].wait_variable(
                    self.items[Items.PLACED_CHECKER])
                moves.append(self.items[Items.LATEST_MOVE])
                print(self.items[Items.LATEST_MOVE])
                self.items[Items.PLACED_CHECKER].set(0)
        print(moves)
        if any(t < 0 for _, t in moves):
            moves = self.map_out_moves(moves, possible_moves)
        return moves
示例#2
0
def __possible_move_options_permutations(die: Die) -> [[int]]:
    move_option = list(die.get_roll())

    if die.is_double():
        return [list(repeat(move_option[0], 4))]
    return [move_option, [move_option[1], move_option[0]]]