(Solved) : Suedu Ay1920 Mod Page Viewphp Id 137410 Mia Derisso Program Overview Requirements 1 Want B Q42788193 . . .

su.edu/ay1920/mod/page/view.php?id=137410 Mia Derisso Program Overview/Requirements: 1. We want to build a simple tic tac toeMethods required in this project: You will need the following methods: . initBoard - this method doesnt return anything, it

Methods required in this project: You will need the following methods: . initBoard - this method doesnt return anything, it1. We want to build a simple tic tac toe game. The board should be a 3x3 2-D char array created as a global variable. Every csu.edu/ay1920/mod/page/view.php?id=137410 Mia Derisso Program Overview/Requirements: 1. We want to build a simple tic tac toe game. The board should be a 3×3 2-D char array created as a global variable. Every cell in the 2D array should initially be a space char. We will use a method called initBoard to accomplish this. Additionally, we will create a global char variable called winning Player 2. We will alternate between X and O’s turn, starting with X 3. Each turn, we will print out a message “Player X’s turn” or “Player O’s turn” and then prompt the user for 2 integers: an x and y coordinate (ask for x first, y second) 4. We will then edit the board to put the player’s piece in that coordinate on the board. Each turn we should print out the current state of the board after they place their piece 5. After each player’s turn we will check for a win condition in a separate method. If there is a win condition (a row, a column, or a diagonal), we will return true with this method. Otherwise we return false. If there is a winning combination, we will grab a char from a winning tile and assign the value to our global variable. 6. If the checkWinCondition method from the previous step returns a space, we check for a tie game. In a tie game, there is an X or Y in every square on the board and there was no winning condition. 7. If there is no winner and the board still has room, we will repeat steps 2-6 again. 8. If there was a winner OR the game was a tie, we will exit the loop and announce the winner or tio and end the program. Hints/Help: Creating global variables Remember that, because we are accessing everything through the main method, all of our other methods and global variables should have the public static keywords in them You will otherwise get an error that says “cannot access non-static variable method from static context Looping through game This should be inside of the main method. We need a boolean flag called is WinCondition that will be initialized as false. Within the while loop we will continue it so long as this flag variable is false (HINT: ‘while(isWinCondition)” checks if the variable is true). At the end of each loop, we will use the checkWinCondition method and capture its return in the is WinCondition variable. Checking win conditions: There are several methods of doing this. The easiest way is to create a series of if-else statements that hard-code check for the winning condition. We want to check each row, each column, and each diagonal. For instance, if we wanted to check the first row in our board, our if statement would be something like this: Methods required in this project: You will need the following methods: . initBoard – this method doesn’t return anything, it simply goes through the board array and puts a space (”) char in each cell. This should only be run once at the start of the program. • checkwinCondition-returns a boolean true/false based on whether we have a winning combination or not at the end of each turn. It will also set the winningPlayer global variable to the char in one of the winning tiles. . 1sTieGame-returns a boolean true/false based on whether each cell in the board has an X or O. • printBoardstate-loops through our 2-D array and prints out the board example output below: [X] [ [ [ ][0] [X] [][[] • NOTE: for printBoardState, we will need to manually print out the opening and closing brackets in each coll. Last modified: Friday, 25 October 2019, 12:19 PM Lab & Submission Jump to… Demo Code Methods required in this project: You will need the following methods: . initBoard – this method doesn’t return anything, it simply goes through the board array and puts a space (‘) char in each cell. This should only be run once, at the start of the program • checkwinCondition-returns a boolean true false based on whether we have a winning combination or not at the end of each turn. It will also set the winningPlayer global variable to the char in one of the winning tiles. istieGame-returns a boolean true/false based on whether each cell in the board has an Xoro. • printBoardstate – loops through our 2-D array and prints out the board (example output below) [X] [ ][ [ ][0][X] [ [ [ . NOTE: for printBoardState, we will need to manually print out the opening and closing brackets in each coll Last modified: Friday, 25 October 2019, 12:19 PM Lab Submission Jump to Demo Code 1. We want to build a simple tic tac toe game. The board should be a 3×3 2-D char array created as a global variable. Every coll in the 2D array should it be a space char. We will use a method called InitBoard to accomplish this. Additionally, we will create a global char variable called winningPlayer 2. We will alternate between X and O’s turn, starting with X 3. Each turn, we will print out a message “Player X’s turn” or “Player O’s turn and then prompt the user for 2 integers: an x and y coordinate (ask for first y Second) 4. We will then edit the board to put the player’s piece in that coordinate on the board. Each turn we should print out the current state of the board after they place their piece. 5. After each player’s turn we will check for a win condition in a separate method. If there is a win condition (a row, a column, or a diagonal), we will return true with this method. Otherwise we return false. If there is a winning combination, we will grab a char from a winning tile and assign the value to our global variable 6. If the checkWinCondition method from the previous step returns a space, we check for a tie game. In a tie game, there is an Xory in every square on the board and there was no winning condition 7. If there is no winner and the board still has room, we will repeat steps 2-6 again. 8. If there was a winner OR the game was a tio, we will exit the loop and announce the winner or tie and end the program, Hints/Help: Creating global variables Remember that, because we are accessing everything through the main method, all of our other methods and global variables should have the public static keywords in them You will otherwise get an error that says “cannot access non-static variable method from static context Looping through game This should be inside of the main method. We need a boolean flag called is WinCondition that will be initialized as false. Within the while loop we will continue it so long as this Hag variable is false (HINT: “Whilois WinCondition)” checks if the variable is true). At the end of each loop, we will use the check WinCondition method and capture som the is WinCondition variable Checking win conditions: There are several methods of doing this. The easiest way is to create a series of if-else statements that hard-code check for the winning condition. We want to check each row each column, and each diagonal For instance, if we wanted to check the first row in our board, our statement would be something like this Show transcribed image text su.edu/ay1920/mod/page/view.php?id=137410 Mia Derisso Program Overview/Requirements: 1. We want to build a simple tic tac toe game. The board should be a 3×3 2-D char array created as a global variable. Every cell in the 2D array should initially be a space char. We will use a method called initBoard to accomplish this. Additionally, we will create a global char variable called winning Player 2. We will alternate between X and O’s turn, starting with X 3. Each turn, we will print out a message “Player X’s turn” or “Player O’s turn” and then prompt the user for 2 integers: an x and y coordinate (ask for x first, y second) 4. We will then edit the board to put the player’s piece in that coordinate on the board. Each turn we should print out the current state of the board after they place their piece 5. After each player’s turn we will check for a win condition in a separate method. If there is a win condition (a row, a column, or a diagonal), we will return true with this method. Otherwise we return false. If there is a winning combination, we will grab a char from a winning tile and assign the value to our global variable. 6. If the checkWinCondition method from the previous step returns a space, we check for a tie game. In a tie game, there is an X or Y in every square on the board and there was no winning condition. 7. If there is no winner and the board still has room, we will repeat steps 2-6 again. 8. If there was a winner OR the game was a tie, we will exit the loop and announce the winner or tio and end the program. Hints/Help: Creating global variables Remember that, because we are accessing everything through the main method, all of our other methods and global variables should have the public static keywords in them You will otherwise get an error that says “cannot access non-static variable method from static context Looping through game This should be inside of the main method. We need a boolean flag called is WinCondition that will be initialized as false. Within the while loop we will continue it so long as this flag variable is false (HINT: ‘while(isWinCondition)” checks if the variable is true). At the end of each loop, we will use the checkWinCondition method and capture its return in the is WinCondition variable. Checking win conditions: There are several methods of doing this. The easiest way is to create a series of if-else statements that hard-code check for the winning condition. We want to check each row, each column, and each diagonal. For instance, if we wanted to check the first row in our board, our if statement would be something like this:
Methods required in this project: You will need the following methods: . initBoard – this method doesn’t return anything, it simply goes through the board array and puts a space (”) char in each cell. This should only be run once at the start of the program. • checkwinCondition-returns a boolean true/false based on whether we have a winning combination or not at the end of each turn. It will also set the winningPlayer global variable to the char in one of the winning tiles. . 1sTieGame-returns a boolean true/false based on whether each cell in the board has an X or O. • printBoardstate-loops through our 2-D array and prints out the board example output below: [X] [ [ [ ][0] [X] [][[] • NOTE: for printBoardState, we will need to manually print out the opening and closing brackets in each coll. Last modified: Friday, 25 October 2019, 12:19 PM Lab & Submission Jump to… Demo Code
Methods required in this project: You will need the following methods: . initBoard – this method doesn’t return anything, it simply goes through the board array and puts a space (‘) char in each cell. This should only be run once, at the start of the program • checkwinCondition-returns a boolean true false based on whether we have a winning combination or not at the end of each turn. It will also set the winningPlayer global variable to the char in one of the winning tiles. istieGame-returns a boolean true/false based on whether each cell in the board has an Xoro. • printBoardstate – loops through our 2-D array and prints out the board (example output below) [X] [ ][ [ ][0][X] [ [ [ . NOTE: for printBoardState, we will need to manually print out the opening and closing brackets in each coll Last modified: Friday, 25 October 2019, 12:19 PM Lab Submission Jump to Demo Code
1. We want to build a simple tic tac toe game. The board should be a 3×3 2-D char array created as a global variable. Every coll in the 2D array should it be a space char. We will use a method called InitBoard to accomplish this. Additionally, we will create a global char variable called winningPlayer 2. We will alternate between X and O’s turn, starting with X 3. Each turn, we will print out a message “Player X’s turn” or “Player O’s turn and then prompt the user for 2 integers: an x and y coordinate (ask for first y Second) 4. We will then edit the board to put the player’s piece in that coordinate on the board. Each turn we should print out the current state of the board after they place their piece. 5. After each player’s turn we will check for a win condition in a separate method. If there is a win condition (a row, a column, or a diagonal), we will return true with this method. Otherwise we return false. If there is a winning combination, we will grab a char from a winning tile and assign the value to our global variable 6. If the checkWinCondition method from the previous step returns a space, we check for a tie game. In a tie game, there is an Xory in every square on the board and there was no winning condition 7. If there is no winner and the board still has room, we will repeat steps 2-6 again. 8. If there was a winner OR the game was a tio, we will exit the loop and announce the winner or tie and end the program, Hints/Help: Creating global variables Remember that, because we are accessing everything through the main method, all of our other methods and global variables should have the public static keywords in them You will otherwise get an error that says “cannot access non-static variable method from static context Looping through game This should be inside of the main method. We need a boolean flag called is WinCondition that will be initialized as false. Within the while loop we will continue it so long as this Hag variable is false (HINT: “Whilois WinCondition)” checks if the variable is true). At the end of each loop, we will use the check WinCondition method and capture som the is WinCondition variable Checking win conditions: There are several methods of doing this. The easiest way is to create a series of if-else statements that hard-code check for the winning condition. We want to check each row each column, and each diagonal For instance, if we wanted to check the first row in our board, our statement would be something like this

Expert Answer


Answer to su.edu/ay1920/mod/page/view.php?id=137410 Mia Derisso Program Overview/Requirements: 1. We want to build a simple tic ta…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us