What really cause me trouble was minimax. My whole group had a lot of trouble with it and we came up with some really complicated methods that did not work. After taking a step back and rereading the assignment page, I realized that we were probably over-complicating it. The assignment handout pretty much gave us the exact algorithm for the minimax strategy:
I then worked on translating this algorithm to code. I had trouble pairing the moves with their scores, but that was fixed with the help of a helper function (they're so helpful aren't they?).
The final problem was that minimax worked with subtract square and not tippy. It took a lot of tracing through the Wing debugger, but we eventually realized that apply_move() in TippyGameState was changing the original game state. This was fixed with the use of deepcopy() (Thanks again to Piazza).
We had the same issue as you when we encountered the minimax. We has been told that follow the algorithm while doing minimax that would be helpful during office hour, which was a good approach. And I also agree with you that helper function is useful as we applied helper function to almost every function in A3.
ReplyDeleteIt's nice to see that other people also struggled with minimax. It makes me fell less alone.
DeleteHelper functions are super useful. I also used them for almost every function in A3.
Thanks for the comment.