Example #1
0
def test_all_attacking():
    """
    test:permet de faire attacker les animaux
    """
    dog_0 = Dog("Dog-0", 5, 10, "Voice-Dog-0")
    dog_1 = Dog("Dog-1", 5, 20, "Voice-Dog-1")
    dog_2 = Dog("Dog-2", 5, 10, "Voice-Dog-2")
    dog_3 = Dog("Dog-3", 50, 10, "Voice-Dog-3")
    dog_4 = Dog("Dog-4", 5, 20, "Voice-Dog-4")
    dog_5 = Dog("Dog-5", 15, 10, "Voice-Dog-5")
    dog_6 = Dog("Dog-6", 50, 20, "Voice-Dog-6")
    dog_7 = Dog("Dog-7", 5, 30, "Voice-Dog-7")

    enclosure_0 = Enclosure(
        "Enclos-0", [dog_0, dog_1, dog_2, dog_3, dog_4, dog_5, dog_6, dog_7])
    print("=== Before attack:")
    print(str(enclosure_0.to_string()))
    print("=== After attack:")
    enclosure_0.all_attacking()
    print(str(enclosure_0.to_string()))
Example #2
0
def test_all_attacking():
    """
    test:permet de retirer un Animal de la liste en fonction de sa position dans la liste
    """
    dog_0 = Dog("Dog-0", 5, 10, "Voice-Dog-0")
    dog_1 = Dog("Dog-1", 5, 10, "Voice-Dog-1")
    dog_2 = Dog("Dog-2", 5, 10, "Voice-Dog-2")
    dog_3 = Dog("Dog-3", 5, 10, "Voice-Dog-3")
    dog_4 = Dog("Dog-4", 5, 10, "Voice-Dog-4")
    dog_5 = Dog("Dog-5", 5, 10, "Voice-Dog-5")
    dog_6 = Dog("Dog-6", 5, 10, "Voice-Dog-6")
    dog_7 = Dog("Dog-7", 5, 10, "Voice-Dog-7")

    enclosure_0 = Enclosure(
        "Enclos-0", [dog_0, dog_1, dog_2, dog_3, dog_4, dog_5, dog_6, dog_7])
    assert enclosure_0.all_attacking() == 0