Example #1
0
def game(n):
    lis = game_build(n)
    steps = len(lis)
    if (steps > 0):
        for i in range(steps):
            print_header(i + 1, steps)
            my_print(lis[i])
Example #2
0
def game(n):
    lis = game_build(n)
    steps = len(lis)
    if (steps > 0):
        for i in range(steps):
            print_header(i + 1, steps)
            my_print(lis[i])
Example #3
0
def pattern(n):
    max_val = 0
    for i in range(n):
        pos = len(game_build(i))
        print_hist(i, pos, n - 1)
        if (pos > max_val):
            max_val = pos
    my_print('')
    my_print("max: " + str(max_val))
Example #4
0
def pattern(n):
    max_val = 0
    for i in range(n):
        pos = len(game_build(i))
        print_hist(i, pos, n - 1)
        if (pos > max_val):
            max_val = pos
    my_print('')
    my_print("max: " + str(max_val))
Example #5
0
def print_usage():
    my_print("Usage for the 3n + 1 game")
    my_print("         python game.py <type> <num>\n")
    my_print(
        "         type - {freq | one}, frequency will show hitogram data of the number of steps taken for 1 - num, one will just run it once and show the steps needed for num"
    )
    my_print(
        "         num  - either the max value for frequency mode or the value to display for one mode"
    )
Example #6
0
def print_hist(i, n, max_val):
    print_header(i, max_val)

    # I need this stupid case because of line wrapping
    if (n > 150):
        my_print(n)
        return
   
    for k in range(n):
        my_print('x', e = '')
    if (i > 0):
        my_print(' -- ' + str(n))
    else:
    	my_print('0')
Example #7
0
def print_hist(i, n, max_val):
    print_header(i, max_val)

    # I need this stupid case because of line wrapping
    if (n > 150):
        my_print(n)
        return

    for k in range(n):
        my_print('x', e='')
    if (i > 0):
        my_print(' -- ' + str(n))
    else:
        my_print('0')
Example #8
0
def print_usage():
    my_print("Usage for the 3n + 1 game")
    my_print("         python game.py <type> <num>\n")
    my_print("         type - {freq | one}, frequency will show hitogram data of the number of steps taken for 1 - num, one will just run it once and show the steps needed for num")
    my_print("         num  - either the max value for frequency mode or the value to display for one mode")
Example #9
0
def print_header(i, n):
    for k in range(num_digits(n) - num_digits(i)):
        my_print(' ', e = '')
    my_print(str(i) + ": ", e = '')
Example #10
0
def print_header(i, n):
    for k in range(num_digits(n) - num_digits(i)):
        my_print(' ', e='')
    my_print(str(i) + ": ", e='')