Esempio n. 1
0
from dice import Dice

position_initiale = int(input("valeur initiale du dé :"))
position_finale = int(input("position finale du dé :"))

nombre_lancer = 0
de = Dice(position_initiale)

while position_finale != de.get_position():
    de.roll()
    nombre_lancer += 1

print("Il a fallut : ", nombre_lancer, "lacers")
def test_dice_creation_no_argument():
    dice = Dice()
    assert dice.get_position() == 1
def test_set_position():
    dice = Dice()
    assert dice.get_position() == 1
    dice.set_position(3)
    assert dice.get_position() == 3
def test_roll():
    dice = Dice()
    dice.roll()
    assert 1 <= dice.get_position() <= 6