minmax algorithm working to reasonable degree