classdef SimpleAI < Player
    methods
        function ai=SimpleAI(color)
            ai@Player(color);
        end
        
        function nextMove = getMove(player, game, board)
            possibleMoves = {};
            for row=1:board.size
                for col=1:board.size
                    if (board.isEmpty([row col]))
                        %disp([row col]);
                        possibleMoves{length(possibleMoves)+1} = [row col];
                    end
                end
            end
            pause(0.5);
            
            if (~isempty(possibleMoves))
                nextMove = possibleMoves{floor(rand()*length(possibleMoves))+1};
            else
                nextMove = [];
                game.ended = true;
            end
            %disp(nextMove);
        end
    end
end
