本文整理汇总了Python中location.Location.next_location方法的典型用法代码示例。如果您正苦于以下问题:Python Location.next_location方法的具体用法?Python Location.next_location怎么用?Python Location.next_location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类location.Location
的用法示例。
在下文中一共展示了Location.next_location方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_next_location3
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import next_location [as 别名]
def test_next_location3():
loc = Location(2, 2, 3)
loc_x, loc_y, x, y = loc.next_location("down", 10, loc.size + 1)
assert loc_y == 0
assert loc_x == 2
loc_x, loc_y, x, y = loc.next_location("right", loc.size + 1, 10)
assert loc_x == 0
assert loc_y == 2
示例2: test_next_location2
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import next_location [as 别名]
def test_next_location2():
loc = Location(0, 0, 3)
loc_x, loc_y, x, y = loc.next_location("up", 10, -1)
assert loc_y == 2
assert loc_x == 0
loc_x, loc_y, x, y = loc.next_location("left", -1, 10)
assert loc_x == 2
assert loc_y == 0
示例3: test_next_location
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import next_location [as 别名]
def test_next_location():
loc = Location(1, 1, 3)
loc_x, loc_y, x, y = loc.next_location("up", 10, -1)
assert loc_y == 0
assert loc_x == 1
loc_x, loc_y, x, y = loc.next_location("down", 10, loc.size + 1)
assert loc_y == 2
assert loc_x == 1
loc_x, loc_y, x, y = loc.next_location("left", -1, 10)
assert loc_x == 0
assert loc_y == 1
loc_x, loc_y, x, y = loc.next_location("right", loc.size + 1, 10)
assert loc_x == 2
assert loc_y == 1
示例4: test_location_on_obstacle
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import next_location [as 别名]
def test_location_on_obstacle(self):
grid = Grid(3, 3)
grid.place_obstacle(0, 1)
location = Location(grid, 0, 0, direction.N)
self.assertFalse(location.is_on_obstacle())
next_location = location.next_location(command.F)
self.assertTrue(next_location.is_on_obstacle())
示例5: test_next_location_wrapped
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import next_location [as 别名]
def test_next_location_wrapped(self):
grid = Grid(3, 3)
location = Location(grid, 0, 0, direction.W)
next_location = location.next_location(command.F)
self.assert_location(Location(grid, 2, 0, direction.W), next_location)
next_location = next_location.next_location(command.L)
self.assert_location(Location(grid, 2, 0, direction.S), next_location)
next_location = next_location.next_location(command.F)
self.assert_location(Location(grid, 2, 2, direction.S), next_location)
示例6: test_next_location
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import next_location [as 别名]
def test_next_location(self):
grid = Grid(3, 3)
location = Location(grid, 0, 0, direction.N)
next_location = location.next_location(command.F)
self.assert_location(Location(grid, 0, 1, direction.N), next_location)
next_location = next_location.next_location(command.R)
self.assert_location(Location(grid, 0, 1, direction.E), next_location)
next_location = next_location.next_location(command.F)
self.assert_location(Location(grid, 1, 1, direction.E), next_location)