- Turns Each Turn The User And Al Opponent Will Both Input A Column X In Which To Place A Piece On The Board You Can Ass 1 (59.16 KiB) Viewed 47 times
Turns Each turn, the user and Al opponent will both input a column x in which to place a piece on the board. You can ass
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Turns Each turn, the user and Al opponent will both input a column x in which to place a piece on the board. You can ass
Turns Each turn, the user and Al opponent will both input a column x in which to place a piece on the board. You can assume the input is always one integer, but you will need to check if the column x is a valid location on the game board later. If the user's chosen column is out of bounds, print "Out of Bounds 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 is Full" and allow the user to move again. Check whether the latest move has created a row, column, 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 win!" and terminate the program. If the opponent plays the winning move, print out "You lose!" and terminate the program. . If the user types in print, the board should be disayed. It is assumed 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 one player move and one opponent move counts as one turn. Example: Turn 1: the user selects 1. The Al opponent selects 0. Turn 2: the user selects 2. The Al opponent selects 0. Turn 3: the user selects 10. "Out of Bounds!" is printed. The user gets a second chance to play, and selects 3. The Al opponent selects 0. Turn 4: the user selects 3. The Al opponent selects 0. The game ends because the opponent has made a stack of four pieces. "You lose!" is printed.