Our first CSC148 assignment was to code a game in which we were to move a stack of cheeses from an initial stool to a destination stool, without placing a larger cheese on top of a smaller cheese. When we were first assigned this project, I had remembered doing a similar puzzle to this (called the "Tower of Hanoi") and was able to recall a strategy in completing the game. After being able to visualize a solution to the game, regardless of the number of stools or cheeses, and through discussion with my partners for the assignment, implementing the code into Python became a somewhat easier task.
I enjoyed working on this assignment for a couple of reasons. Firstly, it helped me practice coding using recursion. In this game there is a least number of moves to move the stack of cheeses depending on the number of cheeses to move. This means that moving a large amount of cheeses uses the same strategy as moving a smaller amount of cheeses. This is a recursive problem, because once we figured out how to move a small stack of cheeses using the least amount of moves (base case), we are able to recall this solution when dealing with a larger instance. Another reason I enjoyed this assignment was because of the opportunity to work in a group. I feel that I am able to learn and grasp content easier when I work through it with others; sharing knowledge and insight.
With this assignment completed, I plan to use reading week to prep for our first term test which will cover quite a bit of content such as OOP, inheritance, recursion and much more.
(Ending these blog posts has always been troublesome for me so I'll just conclude here and wish everyone a productive reading week!)
No comments:
Post a Comment