コード例 #1
0
def test_map8():
    game = pyHell.Game("Resources/Maps/Level/8.txt")

    assert game.GetMap().GetWidth() == 11
    assert game.GetMap().GetHeight() == 14
    assert game.GetPlayer().GetMoveCount() == 12
    assert game.GetMap().At(5, 2).HasType(pyHell.ObjectType.UNDEAD)
    assert game.GetMap().At(5, 2).HasType(pyHell.ObjectType.ENDPOINT)

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 2

    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.LEFT) == pyHell.PlayerStatus.WIN

    assert game.GetPlayer().GetMoveCount() == 0
コード例 #2
0
ファイル: test_game.py プロジェクト: utilForever/HellSolver
def test_undead_check_with_spike():
    game = pyHell.Game("Resources/Maps/Level/3.txt")

    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.GetMap().At(5, 4).HasType(pyHell.ObjectType.UNDEAD) is False
    assert game.GetMap().At(5, 5).HasType(pyHell.ObjectType.UNDEAD) is False
    assert game.GetPlayer().GetMoveCount() == 18
コード例 #3
0
ファイル: test_game.py プロジェクト: utilForever/HellSolver
def test_lock():
    game = pyHell.Game("Resources/Maps/Test/LockTest.txt")

    assert game.GetMap().At(1, 1).HasType(pyHell.ObjectType.KEY)
    assert game.GetPlayer().GetMoveCount() == 8
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 7
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 6
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 5
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().HasKey() is True
    assert game.GetPlayer().GetMoveCount() == 4
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 3
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 2
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 1
    assert game.MovePlayer(pyHell.Direction.RIGHT) == pyHell.PlayerStatus.WIN
    assert game.GetPlayer().GetMoveCount() == 0
コード例 #4
0
def test_map4():
    game = pyHell.Game("Resources/Maps/Level/4.txt")

    assert game.GetMap().GetWidth() == 10
    assert game.GetMap().GetHeight() == 7
    assert game.GetPlayer().GetMoveCount() == 23
    assert game.GetMap().At(7, 3).HasType(pyHell.ObjectType.ENDPOINT)
    assert game.GetMap().At(6, 2).HasType(pyHell.ObjectType.LOCK)

    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(pyHell.Direction.DOWN) == pyHell.PlayerStatus.WIN

    assert game.GetPlayer().GetMoveCount() == 0
コード例 #5
0
def test_map1():
    game = pyHell.Game("Resources/Maps/Level/1.txt")

    assert game.GetMap().GetWidth() == 9
    assert game.GetMap().GetHeight() == 8

    assert game.GetMap().At(1, 1).HasType(pyHell.ObjectType.WALL)
    assert game.GetMap().At(4, 2).HasType(pyHell.ObjectType.UNDEAD)
    assert game.GetMap().At(2, 5).HasType(pyHell.ObjectType.ROCK)
    assert game.GetMap().At(6, 6).HasType(pyHell.ObjectType.ENDPOINT)

    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.RIGHT) == pyHell.PlayerStatus.WIN

    assert game.GetPlayer().GetMoveCount() == 0

    game.Reset()
    assert game.GetPlayer().GetMoveCount() == 23
コード例 #6
0
ファイル: test_game.py プロジェクト: utilForever/HellSolver
def test_is_game_end():
    game = pyHell.Game("Resources/Maps/Test/IsGameEndTest.txt")

    assert game.GetMap().At(2, 1).HasType(pyHell.ObjectType.SPIKE)
    assert game.GetPlayer().GetMoveCount() == 10
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 10
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 8
    assert game.MovePlayer(pyHell.Direction.RIGHT) == pyHell.PlayerStatus.WIN
コード例 #7
0
ファイル: test_game.py プロジェクト: utilForever/HellSolver
def test_sliding_undead():
    game = pyHell.Game("Resources/Maps/Test/SlidingUndead.txt")

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.DOWN) == pyHell.PlayerStatus.WIN
コード例 #8
0
ファイル: test_game.py プロジェクト: utilForever/HellSolver
def test_undead_mark_dead():
    game = pyHell.Game("Resources/Maps/Test/UndeadMakeDead.txt")

    assert game.GetMap().At(1, 1).HasType(pyHell.ObjectType.PLAYER)
    assert game.GetPlayer().GetMoveCount() == 4
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 2
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.RIGHT) == pyHell.PlayerStatus.WIN
    assert game.GetPlayer().GetMoveCount() == 0
コード例 #9
0
ファイル: test_game.py プロジェクト: utilForever/HellSolver
def test_dancing_rock():
    game = pyHell.Game("Resources/Maps/Test/DancingRock.txt")

    assert game.GetMap().At(1, 1).HasType(pyHell.ObjectType.PLAYER)
    assert game.GetPlayer().GetMoveCount() == 4
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 2
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.DOWN) == pyHell.PlayerStatus.WIN
    assert game.GetPlayer().GetMoveCount() == 0
    assert game.GetMap().At(3, 1).HasType(pyHell.ObjectType.ROCK)
コード例 #10
0
ファイル: test_game.py プロジェクト: utilForever/HellSolver
def test_undead_with_lurker():
    game = pyHell.Game("Resources/Maps/Test/UndeadWithLurker.txt")

    assert game.GetMap().GetWidth() == 5
    assert game.GetMap().GetHeight() == 5

    assert game.GetMap().At(2, 1).HasType(pyHell.ObjectType.UNDEAD)
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.DOWN) == pyHell.PlayerStatus.WIN
コード例 #11
0
ファイル: test_game.py プロジェクト: utilForever/HellSolver
def test_lurker():
    game = pyHell.Game("Resources/Maps/Test/LurkerTest.txt")

    assert game.GetMap().At(7, 1).HasType(pyHell.ObjectType.ENDPOINT)
    assert game.GetMap().At(1, 1).HasType(pyHell.ObjectType.PLAYER)
    assert game.GetPlayer().GetMoveCount() == 8
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 7
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 5
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 3
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 2
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 1
    assert game.MovePlayer(pyHell.Direction.RIGHT) == pyHell.PlayerStatus.WIN
コード例 #12
0
ファイル: test_game.py プロジェクト: utilForever/HellSolver
def test_undead_check_with_lurker():
    game = pyHell.Game("Resources/Maps/Test/UndeadCheckWithLurker.txt")

    assert game.GetPlayer().GetMoveCount() == 6

    assert game.GetMap().At(2, 1).HasType(pyHell.ObjectType.UNDEAD) is True
    assert game.GetMap().At(3, 1).HasType(pyHell.ObjectType.UP) is True
    assert game.GetMap().CanLurkerAttack(game.GetMap().At(3, 1)) is True
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING

    assert game.GetMap().CanLurkerAttack(game.GetMap().At(3, 1)) is False
    assert game.GetMap().At(2, 1).HasType(pyHell.ObjectType.UNDEAD) is False
    assert game.GetMap().At(3, 1).HasType(pyHell.ObjectType.UNDEAD) is True
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING

    assert game.GetMap().At(3, 1).HasType(pyHell.ObjectType.UNDEAD) is False
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(pyHell.Direction.DOWN) == pyHell.PlayerStatus.WIN
コード例 #13
0
ファイル: test_game.py プロジェクト: utilForever/HellSolver
def test_can_move():
    game = pyHell.Game("Resources/Maps/Test/CanMoveTestMap.txt")

    assert game.GetMap().At(3, 2).HasType(pyHell.ObjectType.EMPTY)

    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetPosition().x == 2
    assert game.GetPlayer().GetPosition().y == 2

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetPosition().x == 3
    assert game.GetPlayer().GetPosition().y == 2

    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetPosition().x == 2
    assert game.GetPlayer().GetPosition().y == 2

    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetPosition().x == 2
    assert game.GetPlayer().GetPosition().y == 3
コード例 #14
0
ファイル: test_game.py プロジェクト: utilForever/HellSolver
def test_minus_count():
    game = pyHell.Game("Resources/Maps/Test/CanMoveTestMap.txt")

    assert game.GetMap().At(3, 2).HasType(pyHell.ObjectType.EMPTY)

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.LEFT) == pyHell.PlayerStatus.LOST
コード例 #15
0
def test_map6():
    game = pyHell.Game("Resources/Maps/Level/6.txt")

    assert game.GetMap().GetWidth() == 9
    assert game.GetMap().GetHeight() == 10
    assert game.GetPlayer().GetMoveCount() == 43
    assert game.GetMap().At(6, 8).HasType(pyHell.ObjectType.ENDPOINT)

    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 32

    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 24

    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 22
    assert game.GetPlayer().HasKey()

    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 16

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 13

    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING

    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.DOWN) == pyHell.PlayerStatus.WIN

    assert game.GetPlayer().GetMoveCount() == 1
コード例 #16
0
def test_map2():
    game = pyHell.Game("Resources/Maps/Level/2.txt")

    assert game.GetMap().GetWidth() == 9
    assert game.GetMap().GetHeight() == 8

    assert game.GetMap().At(2, 2).HasType(pyHell.ObjectType.UNDEAD)
    assert game.GetMap().At(4, 2).HasType(pyHell.ObjectType.SPIKE)
    assert game.GetMap().At(5, 6).HasType(pyHell.ObjectType.ENDPOINT)
    assert game.GetPlayer().GetMoveCount() == 24

    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 20

    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 18

    assert game.GetMap().At(2, 1).HasType(pyHell.ObjectType.UNDEAD)

    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.GetMap().At(2, 1).HasType(pyHell.ObjectType.UNDEAD)
    assert game.GetPlayer().GetMoveCount() == 17

    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 16

    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 15

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING

    assert game.GetMap().At(5, 2).HasType(pyHell.ObjectType.SPIKE)
    assert game.GetPlayer().GetMoveCount() == 10

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.DOWN) == pyHell.PlayerStatus.WIN
    assert game.GetPlayer().GetMoveCount() == 0
コード例 #17
0
def test_map9():
    game = pyHell.Game("Resources/Maps/Level/9.txt")

    assert game.GetMap().GetWidth() == 11
    assert game.GetMap().GetHeight() == 8
    assert game.GetPlayer().GetMoveCount() == 33
    assert game.GetMap().At(5, 0).HasType(pyHell.ObjectType.ENDPOINT)

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 30

    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 26

    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 22

    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 15

    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.DOWN) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.RIGHT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 8
    assert game.GetPlayer().HasKey()

    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.GetPlayer().GetMoveCount() == 5
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(
        pyHell.Direction.LEFT) == pyHell.PlayerStatus.PLAYING
    assert game.MovePlayer(pyHell.Direction.UP) == pyHell.PlayerStatus.WIN

    assert game.GetPlayer().GetMoveCount() == 0