Description
According to Wikipedia Connect 4 is, “a two-player connection game in which the players first choose a color and then take turns dropping one colored disc from the top into a seven-column, six-row vertically suspended grid. The pieces fall straight down, occupying the lowest available space within the column. The objective of the game is to be the first to form a horizontal, vertical, or diagonal line of four of one’s own discs.”
Objectives
By completing this assignment, students should be able to:
- Write graphical programs using buttons and labels from JavaFX
- Explain how to build programs using JavaFX along with inheritance and/or interfaces
Design
- What are five classes from JavaFX you will need to complete this assignment? What do you expect to use each class for?
- We have to be able to track whether a spot is marked as Red, Black, or unmarked so we can figure out when someone wins or if there is a tie. How might we do this without having to do lots of string comparisons?
- Is there a way we could perhaps use inheritance or interfaces when designing our board spaces to make determining a winner easier? If so, explain it. If not, explain why not.
- Write an English language algorithm for resetting the board. Be sure to explain what you have to do (and in what order) in order to reset the board.
Implementation
Write a program that will let two users sitting right next to each other play a game of Connect 4 that meets the following criterion:
- The game should be able to be reset so it can be played multiple times.
- The game ends when one person has won or there is a tie.
- The winner should be printed to the command line.
- The user should be able to select a column and have their token (red or black) occupy the lowest available space on the column. (Note: This doesn’t hav







