posaclear.blogg.se

My tic-tac-toe. Java
My tic-tac-toe. Java








my tic-tac-toe. Java

("Thank you for using Alex Montague's Tic Tac Toe game!") ("You take turns placing the x's and o's and whoever gets three in a row first wins.") Įlse if (MenuInput.equals ("Exit") || MenuInput.equals ("exit")) ("The object of this game is to get three of your own x's or o's in a line.") ("You will be playing the game of Tic Tac Toe against the computer.") ("Please enter the number you would like to move your spot to") If (MenuInput.equals ("Play") || MenuInput.equals ("play")) ("If you wish to read the instructions, type 'Instructions'")

my tic-tac-toe. Java

("Welcome to Alex Montague's Tic Tac Toe game!.") Scanner kbReader = new Scanner(System.in) Public static void Tie (char Board) //Tie Methodįor (int row = 0 row < 3 row = row + 1)įor (int column = 0 column < 3 column = column + 1) ("You have lost! Better luck next time.") If (Board = 'O' & Board = 'O' & Board = 'O') Public static void Loser (char Board) //Loser Method If (Board = 'X' & Board = 'X' & Board = 'X') Public static void Winner (char Board) //Winner Method Public static char DrawBoard (char Board) //DrawBoard Methodįor (int row = 0 row < 3 row = row + 1)įor (int column = 0 column < 3 column = column + 1) The purpose of this program is to play a tic tac toe game against the computer I have marked the specific spot I need help with inside the code. The code I have in there now determines a random move for the computer, but can still overwrite a user inputted move and is a little buggy. I have tried multiple things, with no success. have my tic tac toe game 90 % finished, but just can't figure out how to determine a computer generated move.

my tic-tac-toe. Java

("X has the first step, enter a number.") How can I clean up my Tic-Tac-Toe code? What mistakes have I made? Can I use more exception handling? I tried to use exception handling, in isValidStepCheck and takenFieldCheck, but I don't think I used it efficiently. I am currently learning Java I could really use some help from more experienced programmers.










My tic-tac-toe. Java