Example #1
0
def testeCollisionJoueur():
    fonctionnel = True
    tabJoueur1 = [[999.0, 570.0, 'gauche', ''], [990.0, 570.0, 'gauche', ''], 
                  [990, 570, 'haut', ''], [990, 560, 'haut', ''], 
                  [990, 550, 'haut', ''], [990, 540, 'haut', ''], 
                  [990, 530, 'haut', ''], [990, 520, 'haut', ''], 
                  [990, 510, 'haut', ''], [990, 500, 'haut', ''], 
                  [990, 490, 'droite', 'haut'], [999, 490, 'droite', ''], 
                  [1008, 490, 'droite', ''], [1017, 490, 'droite', ''], 
                  [1026, 490, 'droite', ''], [1035, 490, 'droite', ''], 
                  [1044, 490, 'droite', ''], [1053, 490, 'droite', ''], 
                  [1062, 490, 'haut', 'droite'], [1062, 480, 'haut', '']]
    tabJoueur2 = [[1035.0, 570.0, 'droite', ''], [1044.0, 570.0, 'droite', ''],
                   [1044, 570, 'droite', ''], [1053, 570, 'droite', ''],
                    [1062, 570, 'droite', ''], [1071, 570, 'droite', ''],
                    [1080, 570, 'haut', 'droite'], [1080, 560, 'haut', ''],
                    [1080, 550, 'haut', ''], [1080, 540, 'gauche', ''],
                    [1071, 540, 'gauche', ''], [1062, 540, 'gauche', ''],
                    [1053, 540, 'gauche', ''], [1044, 540, 'gauche', ''], 
                    [1035, 540, 'gauche', ''], [1026, 540, 'gauche', ''], 
                    [1017, 540, 'gauche', ''], [1008, 540, 'gauche', ''], 
                    [999, 540, 'gauche', ''], [990, 540, 'gauche', '']]
    chiffre = 1
    lettre = "a"
    try:
        Tron.collisionJoueur(chiffre,tabJoueur2)
    except TypeError:
        print("Fonctionnel")
    else:
        print("""La fonction collisionJoueur ne fonctionne pas.
Elle prend des chiffres.""")
        fonctionnel = False
    if fonctionnel:
        if Tron.collisionJoueur(tabJoueur1,tabJoueur2) == "autre" \
        and Tron.collisionJoueur(tabJoueur2,tabJoueur1) == "joueur": 
            print("La fonction collisionJoueur fonctionne entièrement.")
        else:
            print("La fonction ne donne pas les bonnes valeurs.")
Example #2
0
def testeCollisionJoueur():
    fonctionnel = True
    tabJoueur1 = [[999.0, 570.0, 'gauche', ''], [990.0, 570.0, 'gauche', ''],
                  [990, 570, 'haut', ''], [990, 560, 'haut', ''],
                  [990, 550, 'haut', ''], [990, 540, 'haut', ''],
                  [990, 530, 'haut', ''], [990, 520, 'haut', ''],
                  [990, 510, 'haut', ''], [990, 500, 'haut', ''],
                  [990, 490, 'droite', 'haut'], [999, 490, 'droite', ''],
                  [1008, 490, 'droite', ''], [1017, 490, 'droite', ''],
                  [1026, 490, 'droite', ''], [1035, 490, 'droite', ''],
                  [1044, 490, 'droite', ''], [1053, 490, 'droite', ''],
                  [1062, 490, 'haut', 'droite'], [1062, 480, 'haut', '']]
    tabJoueur2 = [[1035.0, 570.0, 'droite', ''], [1044.0, 570.0, 'droite', ''],
                  [1044, 570, 'droite', ''], [1053, 570, 'droite', ''],
                  [1062, 570, 'droite', ''], [1071, 570, 'droite', ''],
                  [1080, 570, 'haut', 'droite'], [1080, 560, 'haut', ''],
                  [1080, 550, 'haut', ''], [1080, 540, 'gauche', ''],
                  [1071, 540, 'gauche', ''], [1062, 540, 'gauche', ''],
                  [1053, 540, 'gauche', ''], [1044, 540, 'gauche', ''],
                  [1035, 540, 'gauche', ''], [1026, 540, 'gauche', ''],
                  [1017, 540, 'gauche', ''], [1008, 540, 'gauche', ''],
                  [999, 540, 'gauche', ''], [990, 540, 'gauche', '']]
    chiffre = 1
    lettre = "a"
    try:
        Tron.collisionJoueur(chiffre, tabJoueur2)
    except TypeError:
        print("Fonctionnel")
    else:
        print("""La fonction collisionJoueur ne fonctionne pas.
Elle prend des chiffres.""")
        fonctionnel = False
    if fonctionnel:
        if Tron.collisionJoueur(tabJoueur1,tabJoueur2) == "autre" \
        and Tron.collisionJoueur(tabJoueur2,tabJoueur1) == "joueur":
            print("La fonction collisionJoueur fonctionne entièrement.")
        else:
            print("La fonction ne donne pas les bonnes valeurs.")