Hannah's Website
About
Projects
Overview
Bramber Dragon Website
HackSheffield3.0
Connect 4
Spot the Difference
Flood-It
Contact
Connect 4 Game
Language: Java
Requirements
Can be run on command line
Can be displayed on a GUI
Can be played by a human player
Can play against a random computer player
Can play against an intelligent computer player
Gameplay
Command Line
By using the argument -nogui, you can play connect 4 on the command line. The computer will take the first go and then await your move.
To make your move, you must type in the number corresponding to the column and pressing enter. This will then cause a counter to be 'dropped' into the array. You are unable to enter a number outside of the given range, as that will throw an Illegal Column Exception.
When there is a line of 4 counters of the same colour, either vertically, horizontally or diagonally, the winner is declared.
GUI
By using the argument -gui, you can play connect 4 using a Graphical User Interface. You can select who plays each other, whether human or computer. The default is Human v Human, and player 1 will always have the first go.
To make your move, you must click on the corresponding number button. This will then cause a counter to be dropped into the board. As there is only the required range of buttons, it is not possible to drop a counter outside of this range.
When there is a line of 4 counters of the same colour, either vertically, horizontally or diagonally, the game is over. You can start a new game by clicking on the button on the right hand side.