예제 #1
0
파일: game.py 프로젝트: billbindi/fun
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])
예제 #2
0
파일: game.py 프로젝트: billbindi/fun
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])
예제 #3
0
파일: game.py 프로젝트: billbindi/fun
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))
예제 #4
0
파일: game.py 프로젝트: billbindi/fun
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))
예제 #5
0
파일: game.py 프로젝트: billbindi/fun
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"
    )
예제 #6
0
파일: game.py 프로젝트: billbindi/fun
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')
예제 #7
0
파일: game.py 프로젝트: billbindi/fun
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')
예제 #8
0
파일: game.py 프로젝트: billbindi/fun
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")
예제 #9
0
파일: game.py 프로젝트: billbindi/fun
def print_header(i, n):
    for k in range(num_digits(n) - num_digits(i)):
        my_print(' ', e = '')
    my_print(str(i) + ": ", e = '')
예제 #10
0
파일: game.py 프로젝트: billbindi/fun
def print_header(i, n):
    for k in range(num_digits(n) - num_digits(i)):
        my_print(' ', e='')
    my_print(str(i) + ": ", e='')