This project is a Java implementation of the Connections word game, inspired by the New York Times Connections puzzle.
It was built for Fundamentals of Computer Science II (Fundies 2) using the Big-Bang (impworld) library, the World Images library, and the Tester library for interactive programming and testing.
The design follows the functional programming style (no object-oriented classes beyond the required World), relying on immutable world states, event handlers, and rendering functions.
- The game begins with 16 words arranged in a 4x4 grid.
- The goal is to group the words into 4 categories of 4 words each.
- Gameplay is the same as the New York Times version:
- Select words you think belong together.
- If your selection is correct (a full group of 4), the group is locked in.
- Too many incorrect guesses, and you lose.
- The game ends when:
- You find all 4 correct groups (win 🎉), or
- You run out of allowed mistakes (game over ❌).
This program is written in Fundies 2 functional style using the following libraries:
javalib.impworld.*– Provides theWorldandbig-bangloop for interactive programs.javalib.worldimages.*– Provides shapes and text rendering (e.g.,RectangleImage,TextImage,OverlayImage).tester.*– For writing unit tests and verifying world transitions.java.awt.Color– Standard color constants and custom RGB values.java.util.*–ArrayList,Arrays, andRandomfor managing word sets and shuffling.
Core components:
- World state – stores the list of words, selected words, solved groups, and mistake count.
- onMouseClicked – handles selecting/deselecting words.
- onTick (optional, if used) – handles animations or timers.
- makeScene – renders the current state (grid of words, mistakes left, solved categories).
- end condition – checks whether the player has won or lost.