Wednesday, 25 March 2015

Thoughts on A3

                I have just started working on A3 yesterday. A3 is different from the previous assignments in that we get to choose from two choices. We can either improve on our strategy minimax, or we can work on functions for a gamestate tree. My partner and I chose to work on the second option, since we we’re not confident in our strategy minimax.

                The first few functions in the assignment were very similar to a lot of tree recursion functions we did earlier in the semester. The functions were fairly easy to implement. I recall in my second slog, I was still struggling with recursion. That was when we first started learning about it. Now, whenever I have to come up with a function that involves recursion, I still use the method I learn from a month ago, which is to come up with a if statement for the most basic case, then an else statement for more complicated case using recursion. I think my skills of using recursion have improved because of practice from this last one and a half month.


                I think this assignment is surprisingly the easiest assignment we had. This may be because while the difficulty of the assignment remained the same, I improved a lot from one month ago. However, the last two functions are supposedly very difficult. I look forward to completing them soon.

Monday, 16 March 2015

Test 2 Reflections

                Last Wednesday we had our second term test of the year. For me the second term test felt slightly easier than the first one. The test covered topics of binary trees, binary tree nodes, linked lists, and linked lists node.

                The first question on the test was on the length of binary trees and the order of the nodes visited. This was a fairly straightforward question, since it was mostly based on basic knowledge of tree structures and the definitions. The second question was to come up with a binary search tree function list_even_between. The question is similar to a function we touched upon in the tutorials. The solution involves making a left list, a middle list, and a right list, while calling recursion on both the left and right side of the binary search tree. The third question is a linkedlist function called absorb value, which deletes a value and adds it to the value after it. This question is also similar to another function in the tutorial. Luckily, I had some of the tutorial functions recorded in my cheat sheet, which really helped me on this question.


                Because of the TA strike, we did not have a tutorial last week. This was a shame, since this class’s tutorials really helped a lot.

Monday, 9 March 2015

LLNode and LinkedList

  Last week we started a new class, Linkedlist and LLNode. A LinkedList is, as its name suggests, a bunch of lists that are linked together. Class LLNode is specific to LinkedLists, and LinkedLists are essentially one or more LLNodes combined. This concept was confusing to me at the beginning. However, it really helped when I reviewed the codes posted online. By carefully looking through the code and starter functions provided, I have a much better idea of how the classes work.


  Because of the TA strike, there was no tutorial last week. I briefly tried the tutorial exercise on LinkedList and found it much harder than I expected. This is when I realized I still don’t understand the material well enough. Fortunately, the solution posted on the course website helped me a lot on this topic. After looking at the solution for the first function, I had a much better idea of what to do. With the help of while loops, we can find the correct section of the LinkedList we want to work with. By the way, as Danny suggested, drawing pictures really helped. For me, it shows and reminds me where to “disconnect” or “connect” the LinkedList in different functions.

Monday, 2 March 2015

Thoughts on A2

  For the past two weeks, I have been working on assignment 2. This assignment is in a way an extension of assignment 1 because we are working with the same classes (Gamestate, Gameview, Move, Strategy). However, the game Tippy is more complicated than Subtract Square (referred as SS). For example, there are different situations the game Tippy can end, while SS can only end with the number being 0. Also Tippy can end in a tie, another new condition that needs to be considered.

  I did not encounter any major slumps while working on class TippyGameState and class TippyMove. Most of the functions are straightforward and very similar to those in assignment 1. One tip I noticed is the importance to come up with a plan first before starting coding. In this case, it was important to know how I was going to represent the squares on the board. I chose to use coordinates in the form of tuples, and several important functions were dependent on this choice.

  In the past few days I was stuck for the longest time on class Minimax. There were two problems that I could not solve for my suggest_move function to work properly. The first was to return an available move at the state. Since the suggest_move function uses recursion and calls upon itself, the move that it analyzes when it calls on itself is a move in the next step. Eventually, the move it will return is that in the final step it analyzes. The other problem lies in the scores 1 and -1 that are assigned to each player in each state of the game. When the function uses recursion and analyzes the next state, the state.next_player variable switches, and the scores should be flipped. As of now, we have not found a way to implement this into our code.

  There is still three days left until the assignment is due. With all other parts of the assignment done, I am positive that we can come up with a way to implement class Minimax.