Refactor GameLoop and add tests for minimax