Fix minimax implementation and add tests for win/loss/draw.