Beispiel #1
0
def test_final_example():
    expected = 210

    mock_data = '''.#..##.###...#######
##.############..##.
.#.######.########.#
.###.#######.####.#.
#####.##.#.##.###.##
..#####..#.#########
####################
#.####....###.#.#.##
##.#################
#####.##.###..####..
..######..##.#######
####.##.####...##..#
.#####..#.######.###
##...#.##########...
#.##########.#######
.####.#.###.###.#.##
....##.##.###..#####
.#.#.###########.###
#.#.#.#####.####.###
###.##.####.##.#..##
'''
    with patch("builtins.open", mock_open(read_data=mock_data)):
        actual = main()

    assert actual == expected
Beispiel #2
0
 def test_part1(self):
     assert part1.main() == 2870072642
Beispiel #3
0
import part1

for v12 in range(10000):
    v1 = v12 / 100
    v2 = v12 % 100
    if 19690720 == part1.main('input.txt', v1=v1, v2=v2): print(v12)
Beispiel #4
0
    state = torch.zeros(3, 9).scatter_(0, state, 1).view(1, 27)
    pr = policy(Variable(state))
    return pr.data


def load_weights(policy, episode):
    """Load saved weights"""
    weights = torch.load("ttt/policy-{}.pkl".format(episode))
    policy.load_state_dict(weights)


if __name__ == '__main__':
    import part1

    print('Running part1.py...')
    part1.main()
    print('...part1.py finished\n')
    import part2b

    print('Running part2b.py...')
    part2b.main()
    print('...part2b.py finished\n')
    print('Part 5 skipped. Please open and run part5.py separately, being \
sure to enter a, b, c, or d.\n')
    import part6

    print('Running part6.py...')
    part6.main()
    print('...part6.py finished\n')
    import part7
Beispiel #5
0
 def test_scenario0(self):
     assert part1.main('./scratch.txt') == 23
Beispiel #6
0
 def test_scenario1(self):
     assert part1.main('./scratch1.txt') == 58
Beispiel #7
0
 def test_part1(self):
     assert part1.main() is None
Beispiel #8
0
 def test_part1_scenario4(self):
     assert part1.main('./scratch4.txt') == 2210736
Beispiel #9
0
 def test_part1_scenario3(self):
     assert part1.main('./scratch3.txt') == 180697
Beispiel #10
0
 def test_part1_scenario2(self):
     assert part1.main('./scratch2.txt') == 13312
Beispiel #11
0
def main():

    part1.main()  # Problem 1 and Problem 3.1
    classification.main()  # Problem 2
    part3.main()  # Problem 3.2