Board The computer will simalate a rectangular 6x7 (height 6, with 7) grid for the board. You a required to use a 3-dime

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Board The computer will simalate a rectangular 6x7 (height 6, with 7) grid for the board. You a required to use a 3-dime

Post by answerhappygod »

Board The Computer Will Simalate A Rectangular 6x7 Height 6 With 7 Grid For The Board You A Required To Use A 3 Dime 1
Board The Computer Will Simalate A Rectangular 6x7 Height 6 With 7 Grid For The Board You A Required To Use A 3 Dime 1 (54.97 KiB) Viewed 59 times
Board The Computer Will Simalate A Rectangular 6x7 Height 6 With 7 Grid For The Board You A Required To Use A 3 Dime 2
Board The Computer Will Simalate A Rectangular 6x7 Height 6 With 7 Grid For The Board You A Required To Use A 3 Dime 2 (73.47 KiB) Viewed 59 times
Board The Computer Will Simalate A Rectangular 6x7 Height 6 With 7 Grid For The Board You A Required To Use A 3 Dime 3
Board The Computer Will Simalate A Rectangular 6x7 Height 6 With 7 Grid For The Board You A Required To Use A 3 Dime 3 (36.29 KiB) Viewed 59 times
Board The computer will simalate a rectangular 6x7 (height 6, with 7) grid for the board. You a required to use a 3-dimensional array to represent the board. The type of this say is up to the programm Before the game begins, the user should be asked whether they want to play a normal or ex pert game A normal game has a 6x7 grid, and requires 4 pieces in a has a 6x9 grid, and requires 5 pires in a row to win. to win. An expert pame IMPORTANT: You are required to make a distinct Board clam. Another clam Game which will contain your main method is also required. We recommend wing the same, but you can name these class whatever you like as long as it is easy to understand Turns Each turn, the user and Al opponent will both input a columnx in which to place a piece on the board. You can aume the input is always one integer, but you will need to check if the colums x is a valid location on the game board later. If the user's chosen column is out of bounds, print "Out of Bound and allow the user to move again If the user's chosen column is already full (ie, the topmost row has been filled), print "Column in Pull and allow the user to move again. Check whether the latest move has created a row, colums, or diagonal of four consecutive pieces. If this is the case, the user has won the game. If the user plays the winning move, print out "You wil" and terminate the program. If the opponent plays the winning ove print out "You lose and terminate the program If the user types in print, the board should be dised It is sumed that the Al opponent will always input a valid column. Make sure to ensure this is the case in your Al code The game should report how many turns it took before the game ended. For the purposes of this project, each rotation of une player move and one opponent move counts as ne tur Example Turn 1: the ser selects 1. The Al opponent selects 0. Turn 2: the user selects 2. The Al opponent selects 0 Turs 3 the user selecta 10. "Out of Bound is printed. The user geta a second chance to play, and incts 3. The Al opponent selects 0. Ture 4 the user selects 3. The Al opponent selects 0. The game ends because the opponent has made a stack of four pinos "You low is printed.
Opponent Al Allowing the user to make their moves is only half the battle. You are required to write a method to make the opponent's moves. In its most basic form, this AI would randomly choose a valid coordinate. However, you are required to make some non-trivial extension to this basic framework. Some options are listed below: • The Al always moves to block a chain of four pieces if the user currently has 3 in a row (or 4 in expert mode). • The AI is more likely to move near where the user made their last move • The Al is able to recognize when they have 3 pieces in a row, and will win the game whenever they have the opportunity to do so. If you would like to pursue a different idea, feel free to do so. Any extension to the AI should require enough extra code to be non-trivial. What counts as "non-trivial" is left to the discretion of the graders. Debug Mode In normal gameplay, the game board is only printed when the user asks for it. However, for grading purposes, you are required to add a debug mode. The game should ask the user whether to run in debug mode and set a flag internally. If the game is in debug mode, print the game board on the screen before every move (twice per turn). This means printing the entire grid, as well as 'X' and 'O' depending on whether a space is taken up by the user or the Al opponent. A space that neither player has moved in yet should be represented by This should be formatted as a grid. 3 If the game is not in debug mode, you should only print the board if the user anks for it.
Getting Started We recommend starting by making the Board class that contains your 2D Array or board. You should first set up the functionality to correctly size the array depending on if the user selects a standard or expert game mode. Implement the print command to help you see the board and make sure that you are able to accurately place a piece by dropping it down as far as it can go before hitting another piece or the bottom of the board in any given column. Board Class .Contains a 2D Array with type of your choosing .Contains int variable to keep tracks of total turna Constructor takes two int variables as arguments and correctly sizes the array upon construc tion • Has drop(int col, char player) function to handle either player dropping their piece in a column Has display() function to print out the board if a player types in the print command (or every turn if in debug mode) . Has connectsFour() method to determine whether a given board state contains any rows, columns, or diagonals of four consecutive pieces of the same type. There should be a similar method called connectaFive() for expert mode Game Class The main function should be in here. Should create and initialize a Board object. Should use Scanner to take in wer inpat until game end Can also contain any helper functions that you may find helpful. It will be very important to have a method to determine the Al opponent's move
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply