Question: CS 250 Program 05 Main topics: User validated input Basic String Methods if & if else Statements Loop Statements Program Specification: Write a Java program



CS 250 Program 05 Main topics: User validated input Basic String Methods if & if else Statements Loop Statements Program Specification: Write a Java program that plays a variation of the game Tic-Tac-Toe: Tally-15 . This is a two player (X's and O's) board game. Each player starts with a tally of 0 The game board is a 3 X 3 grid, where each location initially contains its location's number : 1-9 . The players take turns placing their mark over one of the (empty) locations (one that still contains its location's number) on the grid. In doing so, this number is added to the players tally. If the resulting tally is greater than 15 then their tally is set back to (tally 16) The game is won when a player's tally hits 15 exactly . The game can also reach a stalemate: neither player has won (by above criteria) however there are no more empty locations in the grid. Requirement(s) . Before each turn, your program must display: 1. Whose turn it is 2. What that player's current tally is 3. The current configuration of the board . Your program must use a user-validation loop to obtain each players location choice, and it must not accept any location that is not currently empty Hint(s): Use nine char variables - one for each of the 9 grid locations. Note: each will at all times be set to one of the character digits '1' - '9' or an 'X' or an 'O' . Keep track of the total number of moves, for an easy stalemate detection o At times things will feel very tedious - doing the "same" thing nine times .. Sample run()- Welcome to Tally ! X goes first 's turn-vith tally of Plesse enter location to move [1- 910 Please enter location to sove 4-9)-1 Please eater location to ove [1-9] ! Y's turn-vith tally of Please enter lecation to sove 1 -9:5 Please enter location to sove1-9 19 X'ur-with tally of 5 Please enter lecation to sove1-9: 6 Y'sturn-with tally of9 Pleane enter lecation to ove -9) 8 X' surn -ith tally of 11 Please nter lecation to ove [1 9) 3 Y's turn-with tally of 1 Pleane enter location to rove 1 9:7 x'a turn-wit tally of 14 Please enter location to 0ve [1-9] : 4 Y'a turn-with tally of Pleane enter location to sove [1-9 X's turn-with tally of Pleane enter location to sove [1-9)2 Welcose to Tally-15 Xgoen firat X's tUED-with tally of Please onter location to sove [1-99 Y' turn-with tally of Please enter leeation so eove [1 96 X'turn-vith tally f 9 Please enter lecation to ove [1 92 Y'turn with tally of 6 Pleane enter location to ove [1 91:8 X' turn-with tally of 11 Please onter location to move [1-9] : 4 Congrats-X Wins
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
