本文整理汇总了Python中location.Location.search_free_position方法的典型用法代码示例。如果您正苦于以下问题:Python Location.search_free_position方法的具体用法?Python Location.search_free_position怎么用?Python Location.search_free_position使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类location.Location
的用法示例。
在下文中一共展示了Location.search_free_position方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LocationTest
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import search_free_position [as 别名]
class LocationTest(unittest.TestCase):
def setUp(self):
self.loc = Location(0, 0, 3)
def test_get(self):
l = self.loc.get()
self.assertTrue(l)
def test_get_yx(self):
x = y = self.loc.size - 1
a = self.loc.get(y=y, x=x)
self.assertIsNotNone(a)
def test_search_free_position(self):
x, y = self.loc.search_free_position()
p = self.loc.get(x=x, y=y)
assert p == 0
def test_registred_players(self):
self.loc.register_player("nobus")
self.loc.register_player("bobus")
p = self.loc.get_current_players()
assert len(p) == 2
self.loc.unregister_player("popus")
p = self.loc.get_current_players()
assert len(p) == 2
self.loc.unregister_player("bobus")
p = self.loc.get_current_players()
assert len(p) == 1