我有以下代码
//Querying for move
int playerMove = currentPlayer.PlayCard(myBoard);
//Making move
try {
playMove(playerMove, currentPlayer);
}
catch (IndexOutOfBoundsException e) {
System.out.println("Sorry, I don't think you can do that...");
}
玩家的移动需要与 ArrayList 中的索引相关联。现在,我的代码包含玩家正确做出无效动作的例外,但我想知道如何修改它,以便玩家不断被要求做出动作,直到他们做出有效动作。
谢谢!:)