Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROJECT THIS IS BY USING THE JAVA Connect 4 Game Create a turn based game with a GUI, where players take turns dropping their

JAVA PROJECT

THIS IS BY USING THE JAVA

Connect 4 Game

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

00

01

02

03

04

05

06

10

11

12

13

14

15

16

20

21

22

23

24

25

26

30

31

32

33

34

35

36

40

41

42

43

44

45

46

50

51

52

53

54

55

56

4 consecutive markers in any column

00

01

02

03

04

05

06

10

11

12

13

14

15

16

20

21

22

23

24

25

26

30

31

32

33

34

35

36

40

41

42

43

44

45

46

50

51

52

53

54

55

56

4 consecutive markers in any upward diagonal

00

01

02

03

04

05

06

10

11

12

13

14

15

16

20

21

22

23

24

25

26

30

31

32

33

34

35

36

40

41

42

43

44

45

46

50

51

52

53

54

55

56

4 consecutive markers in any downward diagonal

00

01

02

03

04

05

06

10

11

12

13

14

15

16

20

21

22

23

24

25

26

30

31

32

33

34

35

36

40

41

42

43

44

45

46

50

51

52

53

54

55

56

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 the game CONNECT 4 Board game instructions

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions