This is code for my Tic Tac Toe game. My professor doesn't want us to use while(true) and breaks. I don't know how to change it. Can someone please help me.
public void playerMakeMove()
{
while(true)
{
System.out.println("It is "+username+"'s move");
System.out.println("Give me your best move!");
int move = input.nextInt();
if (validatePlayerMove(move))
{
if (checkPositionAvailability(move))
{
board[move] = 'H'; //'H' for player move
break;
}
else
{
System.out.println("Position not available.\nMake a different choice.");
continue;
}
}
if (move >= 9 || move <= -1)
{
System.out.println("Invalid entry!");
continue;
}