コード例 #1
0
 def test_single_box_dock(self):
     world = World(SIMPLE_LEVEL)
     self.assertEqual(world.box_pos, {(2, 1)})
     self.assertEqual(world.dock_pos, {(1, 1)})
コード例 #2
0
 def test_worker_pos(self):
     world = World(SIMPLE_LEVEL)
     self.assertEqual(world.worker_pos, (4, 1))
コード例 #3
0
    def test_rect_world_dimensions(self):
        world = World(SIMPLE_LEVEL)

        self.assertEqual(world.nrows, 3)
        self.assertEqual(world.ncols, 9)
コード例 #4
0
 def test_multiple_box_dock(self):
     world = World(LARGE_LEVEL)
     self.assertEqual(world.box_pos, {(2, 1), (2, 2)})
     self.assertEqual(world.dock_pos, {(1, 1), (1, 2)})
コード例 #5
0
    def test_nonrect_world_dimenions(self):
        world = World(LARGE_LEVEL)

        self.assertEqual(world.nrows, 4)
        self.assertEqual(world.ncols, 9)
コード例 #6
0
from sokoban.model import World

level = [
    "#########",
    "#.$ @   #",
    "#########",
]

world = World(level)
print(world.nrows)  # 3
print(world.ncols)  # 9
print(world.worker_pos)  # (4, 1)
print(world.box_pos)  # {(2, 1)}
print(world.dock_pos)  # {(1, 1)}