Question
USING JAVA Create a turn based game with a GUI, where players take turns dropping their marker into a column until either someone wins, or
USING JAVA
Create a turn based game with a GUI, where players take turns dropping their marker into a column until either someone wins, or the board is full.
Display the current player on each turn.
At the end of a game display the winner and ask if they want to play again.
Board:
For Connect 4, the board should have 6 rows and 7 columns.
Turn:
A player chooses a column to drop their marker.
Win:
A win is considered 4 consecutive markers in any row, column, or diagonal.
4 consecutive markers in any row
| 4 consecutive markers in any column
|
4 consecutive markers in any upward diagonal
| 4 consecutive markers in any downward diagonal
|
INSTRUCTIONS:
On each turn, the display should show who the current player is.
The board should get filled from bottom to top just like in real life.
After a player drops their marker into the column of their choice, the program should check if he/she is a winner.
If the current player is a winner update the display label to reflect the status and ask if they want to play again.
Otherwise, the alternate player should take a turn.
If the board is full, check for a winner or a tie. Update the display label to reflect the status and ask if they want to play again.
EXTRA CREDIT:
Use image icons on the labels to display a marker when a slot is filled by a player taking a turn (5pts extra)
Create a ConnectX game so that the user can play connect4, or connect5, .. or connectX where they choose how many they would like to be in a row to be considered a win (15pts extra) - must check all diagonals
NOTE: You can use any relevant parts from the Tic Tac Toe project in your project.
Below are the board game rules from Hasbro for more details if you are not familiar with
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started