

def test_one(self):
    number_bots = 2

    def create_TestUniverse(layout, black_score=0, white_score=0):
        initial_pos = [(1, 1), (4, 2)]
        universe = CTFUniverse.create(layout, number_bots)
        universe.teams[0].score = black_score
        universe.teams[1].score = white_score
        for (i, pos) in enumerate(initial_pos):
            universe.bots[i].initial_pos = pos
        if (not ((1, 2) in universe.food_list)):
            universe.teams[1].score += 1
        if (not ((3, 1) in universe.food_list)):
            universe.teams[0].score += 1
        return universe
    test_start = ' ######\n                #0 . #\n                #.  1#\n                ###### '
    universe = CTFUniverse.create(test_start, number_bots)
    game_state = universe.move_bot(1, west)
    test_first_move = ' ######\n                #0 . #\n                #. 1 #\n                ###### '
    self.assertEqual(create_TestUniverse(test_first_move), universe)
    self.assertEqual(game_state['bot_moved'][0], {
        'bot_id': 1,
        'old_pos': (4, 2),
        'new_pos': (3, 2),
    })
    test_second_move = ' ######\n                #0 . #\n                #.1  #\n                ###### '
    game_state = universe.move_bot(1, west)
    self.assertEqual(create_TestUniverse(test_second_move), universe)
    self.assertEqual(game_state['bot_moved'][0], {
        'bot_id': 1,
        'old_pos': (3, 2),
        'new_pos': (2, 2),
    })
    test_eat_food = ' ######\n                #0 . #\n                #1   #\n                ###### '
    self.assertCountEqual(universe.food_list, [(3, 1), (1, 2)])
    game_state = universe.move_bot(1, west)
    self.assertEqual(create_TestUniverse(test_eat_food), universe)
    self.assertCountEqual(universe.food_list, [(3, 1)])
    self.assertEqual(universe.teams[1].score, 1)
    self.assertEqual(game_state, {
        'bot_moved': [{
            'bot_id': 1,
            'old_pos': (2, 2),
            'new_pos': (1, 2),
        }],
        'food_eaten': [{
            'bot_id': 1,
            'food_pos': (1, 2),
        }],
        'bot_destroyed': [],
    })
    test_destruction = ' ######\n                #  . #\n                #0  1#\n                ###### '
    game_state = universe.move_bot(0, south)
    self.assertEqual(create_TestUniverse(test_destruction, black_score=universe.KILLPOINTS), universe)
    self.assertEqual(game_state, {
        'bot_moved': [{
            'bot_id': 0,
            'old_pos': (1, 1),
            'new_pos': (1, 2),
        }, {
            'old_pos': (1, 2),
            'new_pos': (1, 2),
            'bot_id': 0,
        }],
        'food_eaten': [],
        'bot_destroyed': [{
            'bot_id': 1,
            'destroyed_by': 0,
        }],
    })
    test_black_score = ' ######\n                #  0 #\n                #   1#\n                ###### '
    universe.move_bot(0, north)
    universe.move_bot(0, east)
    game_state = universe.move_bot(0, east)
    self.assertEqual(create_TestUniverse(test_black_score, black_score=universe.KILLPOINTS), universe)
    self.assertCountEqual(universe.food_list, [])
    self.assertEqual(universe.teams[0].score, (universe.KILLPOINTS + 1))
    self.assertEqual(game_state, {
        'bot_moved': [{
            'bot_id': 0,
            'old_pos': (2, 1),
            'new_pos': (3, 1),
        }],
        'food_eaten': [{
            'bot_id': 0,
            'food_pos': (3, 1),
        }],
        'bot_destroyed': [],
    })
    test_bot_suicide = ' ######\n                #0   #\n                #   1#\n                ###### '
    universe.move_bot(0, east)
    game_state = universe.move_bot(0, south)
    self.assertEqual(create_TestUniverse(test_bot_suicide, black_score=universe.KILLPOINTS, white_score=universe.KILLPOINTS), universe)
    self.assertEqual(game_state, {
        'bot_moved': [{
            'bot_id': 0,
            'old_pos': (4, 1),
            'new_pos': (4, 2),
        }, {
            'old_pos': (4, 2),
            'new_pos': (1, 1),
            'bot_id': 0,
        }],
        'food_eaten': [],
        'bot_destroyed': [{
            'bot_id': 0,
            'destroyed_by': 1,
        }],
    })

dataset/ETHPy150Open ASPP/pelita/test/test_datamodel.py TestCTFUniverseRules.test_one/original