This week I wrapped up and submitted Assignment 2, where we designed a playable Tippy game state as well as a Minimax computer strategy. While the computer strategy took a while to figure out specifically, and I certainly drew an excessive amount of diagrams, it inevitably amounted to fairly basic recursion. Minimax turned out to be an interestingly powerful implementation of AI, as it not only attempted to win were possible but actively worked against our own victory even when it was impossible for the computer to win. Unfortunately, it took a full minute to decide on a move when starting a 3x3 game and a 4x4 game was downright impractical.
The next most interesting implementation during the game was on how to store the game state of the Tippy game being played. I opted to use a list-within-a-list model where each inner list represented a row in the same and each item in the list represented an item in that row. The problem I later discovered was that creating a new, altered game state retroactively changed the original game state, due to the mutable nature of lists. I ended up using 'deepcopy' to create an immutable copy of the game state, but I think it ended up demonstrating that a mutable data structure is not always ideal and a tuple may have served me more conveniently.
Other than that, I found that rendering the game state in a visually appealing format was the main novel problem of the assignment, which really came down to visual preference. I ended up using a coordinate system but I noticed many people used single numbers to refer to each individual spot on the grid which was a simpler but less intuitive solution, in my opinion. I don't have much else to talk about, in all honesty, so hopefully I'll have more interesting things to say next week and the TA strike will be over (yeah, right)!
No comments:
Post a Comment