<commit_before>"""The tower of Hanoi."""
from __future__ import print_function


def move_towers(height, from_pole, to_pole, with_pole):
    if height == 1:
        print('Moving disk from {0} to {1}'.format(from_pole, to_pole))
    else:
        move_towers(height - 1, from_pole, with_pole, to_pole)
        move_towers(1, from_pole, to_pole, with_pole)
        move_towers(height - 1, with_pole, to_pole, from_pole)  


def main():
    from_pole = 'f' 
    to_pole = 't'
    with_pole = 'w'

    height = 1
    print('height: {}'.format(height))
    move_towers(height, from_pole, to_pole, with_pole)

    height = 2
    print('height: {}'.format(height))
    move_towers(height, from_pole, to_pole, with_pole)

    height = 5 
    print('height: {}'.format(height))
    move_towers(height, from_pole, to_pole, with_pole)

if __name__ == '__main__':
    main()<commit_msg>Revise tower of hanoi alg from Yuanlin<commit_after>"""The tower of Hanoi."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division


def tower_of_hanoi(height, from_pole, to_pole, with_pole, counter):
    if height == 1:
        counter[0] += 1
        print('{0} -> {1}'.format(from_pole, to_pole))
    else:
        tower_of_hanoi(height - 1, from_pole, with_pole, to_pole, counter)
        tower_of_hanoi(1, from_pole, to_pole, with_pole, counter)
        tower_of_hanoi(height - 1, with_pole, to_pole, from_pole, counter)  


def main():
    from_pole = 'A' 
    to_pole = 'B'
    with_pole = 'C'

    height = 1
    counter = [0]
    print('height: {}'.format(height))
    tower_of_hanoi(height, from_pole, to_pole, with_pole, counter)
    print('counter: {}'.format(counter[0]))

    height = 2
    counter = [0]
    print('height: {}'.format(height))
    tower_of_hanoi(height, from_pole, to_pole, with_pole, counter)
    print('counter: {}'.format(counter[0]))

    height = 5
    counter = [0]
    print('height: {}'.format(height))
    tower_of_hanoi(height, from_pole, to_pole, with_pole, counter)
    print('counter: {}'.format(counter[0]))


if __name__ == '__main__':
    main()
{'fraction_non_alphanumeric': 0.1365991521431936, 'fraction_numerical': 0.012246820536975978, 'mean_word_length': 3.6073752711496745, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4375754', 'n_tokens_mistral': 844, 'n_tokens_neox': 751, 'n_words': 178}