Esempio n. 1
0
    def recalculate_orientation(self):
        def is_similar_tile(position):
            tile = self.island.get_tile(position)
            return self.is_barrier(tile)

        origin = self.position.origin
        action = get_tile_alignment_action(origin, is_similar_tile)

        location = self._instance.getLocation()
        self.act(action, location, True)
Esempio n. 2
0
	def recalculate_orientation(self):
		def is_similar_tile(position):
			tile = self.island.get_tile(position)
			return self.is_barrier(tile)

		origin = self.position.origin
		action = get_tile_alignment_action(origin, is_similar_tile)

		location = self._instance.getLocation()
		self.act(action, location, True)
def test_get_tile_alignment_action(expected, tiles):
	"""Tests for the road/wall orientation code.

	Basically `get_tile_alignment_action` returns the sorted list of fields that the tile in
	position . should connect.


	Tile names:

		h a e
		d . b
		g c f
	"""
	tiles, accessor = make_tiles(tiles)
	aligned = get_tile_alignment_action(Point(0, 0), accessor)
	assert aligned == expected
def test_get_tile_alignment_action(expected, tiles):
    """Tests for the road/wall orientation code.

	Basically `get_tile_alignment_action` returns the sorted list of fields that the tile in
	position . should connect.


	Tile names:

		h a e
		d . b
		g c f
	"""
    tiles, accessor = make_tiles(tiles)
    aligned = get_tile_alignment_action(Point(0, 0), accessor)
    assert aligned == expected
def check_alignment(expected_action, tiles):
    tiles, accessor = make_tiles(tiles)
    aligned = get_tile_alignment_action(Point(0, 0), accessor)
    assert aligned == expected_action, 'Expected {0}, got {1} instead'.format(
        expected_action, aligned)
Esempio n. 6
0
def check_alignment(expected_action, tiles):
	tiles, accessor = make_tiles(tiles)
	aligned = get_tile_alignment_action(Point(0, 0), accessor)
	assert aligned == expected_action, 'Expected {0}, got {1} instead'.format(expected_action, aligned)