Example #1
0
    def test_empty_init(self):
        """Test default Hexes creation"""

        # 1. Create default Hexes object
        myhex = hexes.Hexes()

        # 2. Make sure it has the default values
        self.assertEqual(myhex.part2, False)
Example #2
0
    def __init__(self, screen, new_game_engine):
        self._game_engine = new_game_engine
        self._board_screen = screen

        # build tiles
        self._tiles = tiles.Tiles(self._game_engine)
        # build zones on board where tiles fit
        self._board_zones_collection = []
        for i in range(get_num_board_zones()):
            self._board_zones_collection.append(hexes.Hexes())
            self._board_zones_collection[i].number = i
Example #3
0
    def test_part2(self):
        """Test hexes part two examples"""

        # 1. Loop for all of the part two examples
        for example in EXAMPLES:

            # 2. Create the hexes object
            myhex = hexes.Hexes(part2=True)

            # 3. Knot it up, and check result
            self.assertEqual(myhex.furthest(text=example[0], verbose=False),
                             example[2])
Example #4
0
    def test_examples(self):
        """Test hexes part one examples"""

        # 1. Loop for all of the part two examples
        for example in EXAMPLES:

            # 2. Create the hexes object
            myhex = hexes.Hexes()

            # 3. Knot it up, and check result
            self.assertEqual(myhex.steps(text=example[0], verbose=False),
                             example[1])
Example #5
0
def part_one(args, input_lines):
    "Process part one of the puzzle"

    # 1. Create the puzzle solver
    solver = hexes.Hexes(part2=False)

    # 2. Determine the number of steps to the child process
    solution = solver.steps(text=input_lines[0],
                            verbose=args.verbose,
                            limit=args.limit)
    if solution is None:
        print("There is no solution")
    else:
        print("The number of steps to the child process is %d" % (solution))

    # 3. Return result
    return solution is not None
Example #6
0
 def __init__(self):
     super().__init__()
     self.hexes = hexes.Hexes()