[英]I'm having trouble with tic tac toe?
使用數據結構(例如數組或向量)存儲已經進行的移動。 如果用戶嘗試輸入已進行的移動,請重新提示他們:
void getMove()
{
//Get move input from user through something like std::cin
if (hasBeenPlayed()) //If the move (ex: 1) is already in the array or vector
{
getMove();
}
else
{
playedMoves.push_back(move); // Add the move to the vector (or an array)
//Compute the move that was entered here
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.