Exemple #1
0
def test_valid():
    assert valid((1,2,3,4))
    assert not valid((1,1,2,3))
    assert not valid((1,2,3))
    assert not valid((0,2,3,4))
    assert not valid((1,3,4,5,6))
    assert not valid((1,2,2,3,4))
Exemple #2
0
def human_game():
    exact = random_hand()
    while True:
        in_ = raw_input()
        if in_=='end':
            print 'not valid'
            continue

        guess = [int(l) for l in in_ if l.isdigit()]
        if not valid(guess):
            print 'not valid'
            continue

        result = evaluate(guess, exact)
        if result==(4, 0):
            print 'right!', exact
            return

        print result