def test_get_bot_position(self): class Conf(BaseConfiguration, RandomFieldPlacerMixin): map_width = 1 map_height = 1 bots = 1 treasures = 0 blocks = 0 conf = Conf() game = Game(MapFactory.create(conf), configuration=conf) bot_id = 1 game.add_bot(bot_id) self.assertEqual( game.get_bot_position(bot_id), (0, 0) )
def test_export_bots(self): class Conf(DefaultConfiguration): map_width = 2 map_height = 1 bots = 2 treasures = 0 blocks = 0 game = Game(MapFactory().create(Conf())) my_bot_id = 0 bots_export = game._export_bots(my_bot_id) my_bot_on_first_field = game.get_bot_position(my_bot_id) == (0, 0) self.assertListEqual( bots_export, [ dict(x=0, y=0, position=(0, 0), orientation=Orientation.NORTH, your_bot=not my_bot_on_first_field), dict(x=1, y=0, position=(1, 0), orientation=Orientation.NORTH, your_bot=my_bot_on_first_field) ] )