samedi 14 décembre 2019

Validate user input Tic Tac Toe game

I need help with this assignment, I'm not sure how to fix my code. I want to make sure that if the user inputs anything other than numbers it will prompt, "Invalid entry!".

if(checkPositionAvailability(move))

           {

               board[move] = 'H'; //make 'H' for player move

               break;

           }

           else

           {

               System.out.println("Position not available.\nMake a different choice.");

               continue;

           }

       }

       else

       {

           System.out.println("Invalid entry!");

           continue;

       }

   }

Aucun commentaire:

Enregistrer un commentaire