Skip to content

Connect 4 is a Java game that implements the classic game using an interface and GUI. Players can play against a computer opponent that tries to block the player from winning but will occasionally ignore this to keep the game fun.

Notifications You must be signed in to change notification settings

vmsaif/connect4Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Connect 4

Hits

This is a Java program that implements the classic Connect 4 game using an interface and Java GUI. The user can play against a computer opponent, whose logic was implemented by me. The objective of the game is to get four of your colored circles in a line, either horizontally, vertically, or diagonally.

Notice the logic is written in such a way, the computer opponent will try to block the user from winning. However, to keep the game fun, it will ignore occasionally.

What I Have Learned

  1. Implementing interfaces and abstract classes in Java
  2. Designing and implementing the logic for a computer opponent
  3. Working with Java GUI elements, such as buttons and labels
  4. Testing and debugging code to ensure it is functioning correctly

Compiling and Running

Ensure that you have the latest version of Java installed on your computer.

To Compile

javac -d bin src\*.java

Run

java -cp bin\ Main

Follow the prompts in the GUI to play the game.

Visual Demonstration

About

Connect 4 is a Java game that implements the classic game using an interface and GUI. Players can play against a computer opponent that tries to block the player from winning but will occasionally ignore this to keep the game fun.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages