当前位置: 首页>>代码示例>>Python>>正文


Python Location.next_location方法代码示例

本文整理汇总了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
开发者ID:nobus,项目名称:multirog,代码行数:12,代码来源:location_test.py

示例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
开发者ID:nobus,项目名称:multirog,代码行数:12,代码来源:location_test.py

示例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
开发者ID:nobus,项目名称:multirog,代码行数:20,代码来源:location_test.py

示例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())
开发者ID:ilgarm,项目名称:mars_rover_kata,代码行数:11,代码来源:tests.py

示例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)
开发者ID:ilgarm,项目名称:mars_rover_kata,代码行数:14,代码来源:tests.py

示例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)
开发者ID:ilgarm,项目名称:mars_rover_kata,代码行数:14,代码来源:tests.py


注:本文中的location.Location.next_location方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。