/ConnectFour

This project was the culminating task for the ICS4U course. The task of the project was to recreate the classic game "Connect 4" as a digital version that implements a variety of feature extensions and topics learned throughout the course.

Primary LanguageJava

Connect Four Game

This project was the culminating task for the ICS4U course. The task of the project was to recreate the classic game "Connect 4" as a digital version that implements a variety of feature extensions and topics learned throughout the course.

Built With

  • Program extended Jframe, which was used to build the GUI
  • Java 8, Netbeans 8.2 (used in course)

Elements Used and What I Learned

OOP

As this code was built with Java in a course that taught Java, I knew that the culminating assignment should be explicilty be able to display my knowledge of Object Oriented Programming (OOP). To do this, I made sure to split the code into different classes as needed. As result, I had three different classes for each of the GUIs found in the game.

Searching and Sorting Algorithms

Algorthims was another big part of the course, we were taught to read and write into files, as well as how to implement a variety of different searching and sorting algorithms (bubble sort, selection sort, insertion sort as well as linear and binary search). I used searching and sorting to help save the highest win totals on a given day. On my leaderboard screen, I was then able to have buttons that a) searched for the highest score and retrieved the date and b) sorted all the highest scores in either ascending or descending order, based on user input.

Advanced Topics

In my project, I was able to implement a variety of advanced topics such as:

  • Recursion through the win-checking methods

  • Object Arrays storing data objects in a 2d array to track the places each user plays

  • Inheritance to create subclasses of a piece, both a yellow and red piece.

  • Interfaces through the methods which check how the user can win

  • Abstraction and Encapsulation through how the project is run, as well as accessing private variables

What I learned

From this project, I was really able to understand OOP and how to implement into a vision I had. With python, if felt much more "clunky" in the sense that I might've had one file with so many lines of code, which can make it hard to look back and see what I've accomplished. With the OOP approach, I can easily isolate the location of a code I may be working on, or seeing why an error might be occuring. I definetly do enjoy working with Java and OOP, and I am excited to continue my learning in the future.