Saturday 21 March 2015

8 - Eliminating Redundancy

This week we learned about why minimax in Assignment too was slow. We, in great detail, examined a Subtract Square game where the starting value was 9, and it turns out that there are many paths and branches that are exactly identical. Because minimax looks through every single path and does not overlook identical paths, it makes the function very slow, especially on starting numbers that are very high.

We discovered that there are a few ways of taking care of redundancy; the first thing we can do is check if the game are equal with immutable objects. If we used it on mutable objects, there is a chance that the client might change said mutable object and therefore will effect the reliability of the check. One method we could use to check equal game states is the __eq__ method, which we were required to write in both assignments so far. I know see why they can be so useful, especially in Assignment 2.

The next thing we can do is pruning, which is checking whether we can do better than a win, lose, or tie in the current game. If this is so, then the program will only look at the paths that will produce a game state that is better than the current available game states.

No comments:

Post a Comment