Tuesday, 11 February 2014

Classes, Methods, Functions, Subclasses, Visualizers... Oh My

    During this week, I started on Assignment 1. This asks the student to create a series of object oriented functions to manipulate pieces of cheese on stools in the form of a game.
    The game is a simplified, text version of the Tower of Hanoi. For those unfamiliar, the Tower of Hanoi is game consisting of x amount of platforms and x amount of discs placed on the first platform. The goal is to transport the discs across the platforms, moving one disc at a time, and making sure that a bigger disc is never on a smaller discs. So in python, I had to make the game look like this:

                                             -                                    
                                            ---                                    
                                           -----                                  
                                          -------                                  
=========  =========  =========  ========= 

And completion would look like this:

                                                                                         -                                      
                                                                                       ---                                    
                                                                                       -----                                    
                                                                                     -------                                  
=========  =========  =========  ========= 

    This was the most in depth I got into python. The code spanned across 4 different files, a bunch of classes, with a bunch of classes, and a bunch of subclasses as well. The next step of my code is to create a recursive code that makes the cheese get from start to finish as soon as possible with 8 pieces of cheese, and 4 stools. This is going to require a lot of time, as there are now two intermediate stools, but it means the problem will be solved in less moves.... OK back to the drawing board

No comments:

Post a Comment