示例#1
0
def possible_tiles(
        game: Game,
        inverted_clues: bool = False) -> List[Tuple[MapTile, float]]:
    """
    Infer possible tiles from the clue possible clue combinations.

    Args:
        game: Game - Current game.
        inverted_clues: bool - Playing with inverted clue?

    Returns:
        Dict[MapTile: int]] - MapTile with number of clue combinations pointing on them
    """

    return game.possible_tiles(inverted_clues)
示例#2
0
    def test_known_clues_return_a_single_tile(self) -> None:

        PLAYER_1 = Player("red",
                          clues.by_booklet_entry("alpha", 2),
                          teamname="alpha")
        PLAYER_2 = Player("orange",
                          clues.by_booklet_entry("beta", 79),
                          teamname="beta")
        PLAYER_3 = Player("purple",
                          clues.by_booklet_entry("epsilon", 28),
                          teamname="epsilon")

        PLAYERS = [PLAYER_1, PLAYER_2, PLAYER_3]

        game = Game(MAP_DESCRIPTOR, PLAYERS, STRUCTURES)

        possible_tiles = game.possible_tiles()

        self.assertTrue(
            len(possible_tiles) == 1,
            msg=
            "Should always return a single maptile when, all clues are known")
示例#3
0
                    clues_after_placement = infer.possible_clues_after_cube_placement(
                        game.map, player, (tile.x, tile.y))

                    placement_reduces_clues = len(
                        before_placement.difference(clues_after_placement))
                    placement_alternatives[tile] = placement_reduces_clues

            minimum_reveal = sorted(placement_alternatives.items(),
                                    key=lambda x: x[1])[0]

            print("Place cube on x:{} y:{} to reduce {} clues".format(
                minimum_reveal[0].x, minimum_reveal[0].y, minimum_reveal[1]))

        elif cmd == "location prob":

            possible_locations = game.possible_tiles()
            possible_locations = sorted(possible_locations.items(),
                                        key=lambda x: x[1])

            print("Location probabilities")
            print("---------")
            for location, probability in possible_locations:
                print("Tile x:{} y:{} has probability of {}".format(
                    location.x, location.y, probability))

        elif cmd == "question":

            print()

            possible_tiles = game.possible_tiles()
            n_possible_locations = len(possible_tiles.keys())