Conway's Game of Life is a captivating cellular automaton that exhibits intriguing patterns. A cellular automaton consists of a grid of cells, where each cell undergoes state changes based on a predefined set of rules over time.
The Game of Life follows a few fundamental rules:
- Survival: Any live cell with 2 or 3 live neighbours persists to the next generation.
- Underpopulation: Any live cell with fewer than 2 live neighbours dies due to underpopulation.
- Overpopulation: Any live cell with more than 3 live neighbours dies due to overpopulation.
- Reproduction: Any dead cell with exactly 3 live neighbours comes to life, simulating reproduction.
This JavaFX application provides a visually engaging simulation of Conway's Game of Life. The user-friendly graphical interface enables users to interact with the cellular automaton, observe its dynamic evolution, and explore emergent patterns.
-
Random Configuration: Begin the simulation with a dynamically generated random configuration of living cells.
-
Manual Initialization: Take control and manually set your preferred initial cell configuration using your mouse.
-
Basic Configurations: Explore basic configurations, including classics like the Gosper Glider Gun or the Simkin glider gun.
Below is a glimpse of the simulation featuring a randomly generated configuration:
This project was run on Java 17; however, it can likely be run on later versions of Java. If you don't have Java installed, you can download and install it from the official Java Download Page.
This application runs on JavaFX version 20. To install JavaFX, visit the OpenJFX download page. Once JavaFX is installed, configure it correctly in your IDE. If you're using IntelliJ, follow these steps:
- Unzip the JavaFX archive to create a folder named
javafx-sdk-20
with subfolderslegal
andlib
. - In IntelliJ, open settings (
Appearance and Behavior
>Path Variables
). - Click on the
+
button. Under Name, writeJFX_PATH
and under Value, write the path to thelib
subfolder of the unzipped JavaFX archive. - Open IntelliJ IDEA and go to the
File
menu. - Choose
New Project Setup
and then selectStructure
. - In the left sidebar, click on
Global Libraries
under thePlatform Settings
section. - In the central section, click the
+
button at the top and selectJava
from theNew Global Library
menu. - Navigate to the
lib
folder created during the archive decompression of OpenJFX. - Select all files in the
lib
folder and clickOpen
. - Change the name of the library to "OpenJFX 20" by modifying the field next to the
Name:
label. - Click the
+
button under theName:
label. - Select the
src.zip
file located in the parent folder of thelib
folder and clickOpen
. - Click
OK
in the dialog box that opens.
Now that the JavaFX library is correctly installed in your IDE, here is the way to use it in your project:
- In the
File
menu, selectProject Structure
. - Click on
Modules
in theProject Settings
section. - Select the
Dependencies
tab. - Click on the
+
button, then chooseLibrary
from the menu that opens. - In the window that opens, select
OpenJFX 20
, then click onAdd Selected
.
If you encounter issues, try the following:
- In the
Run
menu, chooseEdit Configurations
. - Click on
Modify options
, then chooseAdd VM options
. - In the field entitled
VM options
, add the following line (replace$JFX_PATH$
with your JavaFX Path):--module-path $JFX_PATH$ --add-modules javafx.controls
This setup ensures that the OpenJFX 20 library is properly configured in IntelliJ IDEA, allowing you to seamlessly integrate it into your JavaFX project.