def test_find_pacman():
    map = get_map()

    assert find_pacman(map) == (3, 6)

    map_no_pacman = ["..", ".."]
    assert find_pacman(map_no_pacman) == (-1, -1)
def test_play_outside_borders():
    map = ["@..P"]

    x, y = find_pacman(map)
    play(map, 'a')

    assert find_pacman(map) == (x, y)
def test_play_wall():
    map = ["|@..P"]

    x, y = find_pacman(map)
    play(map, 'a')

    assert find_pacman(map) == (x, y)
Esempio n. 4
0
    def test_find_pacman(self):
        map = get_map()

        self.assertEqual(find_pacman(map), (3, 6))

        map_no_pacman = ["..", ".."]
        self.assertEqual(find_pacman(map_no_pacman), (-1, -1))
def test_play_invalid():
    map = get_map()

    x, y = find_pacman(map)
    play(map, 'x')

    assert find_pacman(map) == (x, y)
def test_play_move():
    map = get_map()

    x, y = find_pacman(map)
    play(map, 'a')

    assert find_pacman(map) == (x, y - 1)
Esempio n. 7
0
    def test_play_wall(self):
        map = ["|@..P"]

        x, y = find_pacman(map)
        play(map, 'a')

        self.assertEqual(find_pacman(map), (x, y))
Esempio n. 8
0
    def test_play_outside_borders(self):
        map = ["@..P"]

        x, y = find_pacman(map)
        play(map, 'a')

        self.assertEqual(find_pacman(map), (x, y))
Esempio n. 9
0
    def test_play_invalid(self):
        map = get_map()

        x, y = find_pacman(map)
        play(map, 'x')

        self.assertEqual(find_pacman(map), (x, y))
Esempio n. 10
0
    def test_play_move(self):
        map = get_map()

        x, y = find_pacman(map)
        play(map, 'a')

        self.assertEqual(find_pacman(map), (x, y - 1))
def test_play_eat_pills():
    map = get_map()

    x, y = find_pacman(map)
    play(map, 'a')

    assert find_pacman(map) == (x, y - 1)
    assert total_pills(map) == 3

    play(map, 'w')

    assert find_pacman(map) == (x - 1, y - 1)
    assert total_pills(map) == 2
Esempio n. 12
0
    def test_play_eat_pills(self):
        map = get_map()

        x, y = find_pacman(map)
        play(map, 'a')

        self.assertEqual(find_pacman(map), (x, y - 1))
        self.assertEqual(total_pills(map), 3)

        play(map, 'w')

        self.assertEqual(find_pacman(map), (x - 1, y - 1))
        self.assertEqual(total_pills(map), 2)
def test_move_pacman():
    map = get_map()

    x, y = find_pacman(map)

    assert is_pacman(map, x, y) is True

    new_x, new_y = x, y - 1
    move_pacman(map, x, y, new_x, new_y)

    assert is_pacman(map, x, y) is False
    assert is_pacman(map, new_x, new_y) is True
Esempio n. 14
0
    def test_move_pacman(self):
        map = get_map()

        x, y = find_pacman(map)

        self.assertTrue(is_pacman(map, x, y))

        new_x, new_y = x, y - 1
        move_pacman(map, x, y, new_x, new_y)

        self.assertFalse(is_pacman(map, x, y))
        self.assertTrue(is_pacman(map, new_x, new_y))