Improve the minimax implementation.

Still slow and not entirely function. Will likely need
to implement alpha-beta pruning in order to speed it up.