谁能帮我写代码来检查用户是否输入了两次相同的坐标?
部分代码:
rc = input('Enter your next move [row space column]: ');
row = rc(1); %users coordinates
col = rc(2);
if row<0 || col<0
disp('Please enter positive coordinates');
rc = input('Enter your next move [row space column]: ');
row = rc(1);
col = rc(2);
end
if row>size || col>size
disp('Please enter cordinates with in the game board');
rc = input('Enter your next move [row space column]: ');
row = rc(1);
col = rc(2);
end
我已经检查了正值和过大的值,但现在我想检查以确保用户没有两次输入相同的坐标,以及是否显示错误消息。感谢任何帮助谢谢