Ejemplo n.º 1
0
    sw = Stopwatch()

    # define the messages
    flags_message = '\n'.join([
        'Please enter a valid flag.', 'Here are a list of the valid flags:',
        '  -b    Begin the stopwatch', '  -e    End the stopwatch'
    ])
    start_message = 'The stopwatch has been started.'
    end_message = 'The stopwatch has been ended and data has been logged.'
    not_started_message = 'The stopwatch has not been started yet'

    # there is no valid flag
    if len(sys.argv) != 2:
        print(flags_message)

    # begin the stopwatch
    elif sys.argv[1] == '-b' or sys.argv[1] == '-s':
        sw.start()
        print(start_message)

    # end the stopwatch
    elif sys.argv[1] == '-e':
        if sw.is_started():
            sw.end()
            print(end_message)
        else:
            print(not_started_message)

    else:
        print(flags_message)
Ejemplo n.º 2
0
stopwatch = Stopwatch()

stopwatch.start()
patterns = set()

for i in range(0, triout):
    board = Board(n)
    # board.print()

    board.fill_full_rays()

    # print("check 1.")
    # board.print()
    unique = board.to_unique()
    # print(f"unique ={unique}")

    patterns.add(unique)

stopwatch.end()

"""
for pattern in patterns:
    print(f"pattern={pattern}")
    Board.from_unique(pattern, n).print()
"""

stopwatch.print()
print(f"patterns number={len(patterns)}")

print("finished")