Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Connect 4 Game GUI using JAVA Create a turn based game with a GUI, where players take turns dropping their marker into a column until

Connect 4 Game GUI 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

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

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

LO37.5 Define and utilize the concept of arbitrage.

Answered: 1 week ago

Question

Write a short note on rancidity and corrosiveness.

Answered: 1 week ago