Sunday, February 1, 2015

First Few Weeks

Dear Blog,

So far CSC148 has been much different than CSC108 but they share some similarities. This class definitely seems like it will be much more challenging. Throughout the first few weeks, we focused on classes, sub-classes, inheritance, exceptions and recursion.

I worked in a group of three for Assignment 1. The assignment was basically my first time dealing with A.I (granted, it was very simple A.I). The idea of the assignment was to create classes and sub-classes of those classes to create a text-based game that you could play against a computer. We had to create the game called "Subtract A Square", where each player subtracts a square number no larger than the current number. The last person to make a subtraction wins. This game involved 5 classes: a game state class, which keeps track of the current state of the game. The subtract square class, which is a sub-class of game state keeps track of the game state specific to subtract square. Then there is a strategy class, and a specific sub-class for strategy used for subtract a square, which just generates a random integer for the computer to choose (simple A.I). Then there is the game view class which keeps track of the game, who's turn it is, whether a move is legal and basically runs the game. The reason for all the inheritance and sub-classes is, for future assignments, we will be adding more specific games and having the general parent classes will make this much easier.

Since these topics, we have been learning recursion. This blog post was very interesting to read about recursion: https://nicoleslog.wordpress.com. The blogger raised some very good points about recursion. They asked three key questions:

  1. What is needed in recursion?
  2. How does recursion work?
  3. What are the benefits of recursion?
I am going to think more about these questions and return next week with more information on recursion. Wish me luck on Wednesday's midterm! 



No comments:

Post a Comment