"> The objective of the game is to move all pieces from the"
              " initial tower, to the last tower. \n \n"
              "> The game's rules are: \n \n"
              "1. You can never move a bigger piece on a smaller piece. \n"
              "2. You can only move one piece at a time \n"
              "3. All disks must only be moved to viable towers \n")
        print(self.model)
        move_input = input("Enter a move or command: ").split()
        while 'exit' not in move_input:
            if len(move_input) == 2 and move_input[0].isdigit() and\
                 move_input[1].isdigit():
                try:
                    source = int(move_input[0]) - 1
                    destination = int(move_input[1]) - 1
                    self.model.move(source, destination)
                    print(self.model)
                except IllegalMoveError as error:
                    print(error)
                move_input = input("Enter a move or command: ").split()
            else:
                move_input = \
                    input("Please enter a legal move or command: ").split()


if __name__ == '__main__':
    controller = ConsoleController(3, 4)
    controller.play_loop()
    import python_ta
    python_ta.check_all(config='consolecontroller_pyta.txt')
    python_ta.check_errors(config='consolecontroller_pyta.txt')
    @type path: str
    @rtype: None
    """
    file_tree = FileSystemTree(path)
    run_visualisation(file_tree)


def run_treemap_population():
    """Run a treemap visualisation for World Bank population data.

    @rtype: None
    """
    pop_tree = PopulationTree(True)
    run_visualisation(pop_tree)


if __name__ == '__main__':
    import python_ta
    # Remember to change this to check_all when cleaning up your code.
    python_ta.check_errors(config='pylintrc.txt')

    # To check your work for Tasks 1-4, try uncommenting the following function
    # call, with the '' replaced by a path like
    # 'C:\\Users\\David\\Documents\\csc148\\assignments' (Windows) or
    # '/Users/dianeh/Documents/courses/csc148/assignments' (OSX)
    run_treemap_file_system('/h/u11/c6/01/seahisaa/Desktop/csc148/labs/lab3/test')

    # To check your work for Task 5, uncomment the following function call.
    run_treemap_population()
Exemple #3
0
        >>> chain = PeopleChain(['Iron Man', 'Janna', 'Kevan'])
        >>> chain.get_nth(1)
        'Iron Man'
        """
        # Remember: you must use a for or while loop in this function body!
        # If you use a for loop but don't need to use the index, use an
        # underscore for the variable name:
        #
        # for _ in range(10):
        #     <code that doesn't use the index>

        current = self.leader
        count = 0
        while (current):
            if (count == n):
                return current.name
            count += 1
            current = current.next

        raise ShortChainError


if __name__ == '__main__':
    import python_ta
    python_ta.check_errors(config='.pylintrc')
    # python_ta.check_all(config='.pylintrc')

    # import doctest
    # doctest.testmod()