Black Box: Classic Deduction Board Game
A comprehensive Java implementation of Eric Solomon's Black Box puzzle game, featuring interactive ray tracing and strategic atom deduction mechanics.
Black Box is a strategic deduction game that challenges players to locate hidden atoms within a hexagonal grid by analyzing ray interactions. This Java implementation brings the classic 1970s puzzle game by Eric Solomon to life with modern interactive gameplay and visual feedback systems.
Game Overview
Core Concept
The game features a hexagonal grid of 61 cells, where a certain number of atoms are secretly placed. Players must deduce the positions of these hidden atoms by shooting rays into the grid from edge points and observing how the rays interact with the atoms.
Key Mechanics:
- Rays can be deflected by atoms at specific angles
- Rays can be absorbed when hitting an atom directly
- Rays can be reflected back when encountering atoms near the entry point
- Players must use logical deduction from ray behavior to determine atom positions
Objective
Locate all hidden atoms using the minimum number of rays. Each ray fired increases your score, so efficiency is key. The challenge combines elements of:
- Strategy: Planning which rays to fire for maximum information
- Logic: Deducing atom positions from ray interactions
- Pattern Recognition: Identifying common atom configurations
Gameplay Preview
Technical Architecture
Technology Stack
- Java 17 (Amazon Corretto): Core language and JVM
- Maven: Build automation and dependency management
- JavaFX: GUI framework for interactive visualization
- JUnit 5: Unit testing framework
Key Features
1. Interactive Ray Simulation
Players shoot rays into the grid from any perimeter hexagon. The ray tracing algorithm calculates interactions with hidden atoms in real-time.
Ray Interaction Types:
| Interaction | Color | Behavior |
|---|---|---|
| Single Deflection | Blue | Ray deflected 60° by one atom |
| Absorption | Green | Ray hits atom directly, no exit |
| Reflection | White | Ray encounters atom at entry, returns immediately |
| Double Deflection | Brown | Ray deflected 120° by two atoms |
| Multiple Deflections | Pink | Ray deflected multiple times at 60° |
| Reversal | Yellow | Ray deflected 180° by two atoms |
| Clear Path | Purple | Ray passes through without interaction |
2. Visual Feedback System
The game provides immediate visual feedback through a color-coded system that helps players interpret ray behavior at a glance.
3. Ray Tracing Algorithm
The core of the game is the ray tracing system, which simulates how a ray travels through the hexagonal grid and interacts with hidden atoms. Each ray is fired from a perimeter entry point and traverses cell by cell according to its direction vector. During its path, the ray may encounter one of several outcomes — direct hit, deflection, double deflection, or no encounter.
4. Dynamic Scoring System
The Dynamic Scoring System rewards logical reasoning while penalizing inefficient play. Each move contributes to the player’s overall score, balancing exploration and accuracy.
The system tracks four main metrics throughout the game:
- Rays Shot: how many times the player fires a beam into the grid.
- Atoms Hit: how many correct atom locations were guessed.
- Atoms Missed: how many guesses were incorrect.
- Score: a weighted total based on performance.
The scoring formula is: Score = (Rays Shot × 1) + (Atoms Hit × -5) + (Atoms Missed × 5) This ensures that:
- Efficient use of rays keeps scores low.
- Correct atom identification reduces the total score.
- Missed guesses add significant penalties.
For example: Score: 32 Rays Shot: 2 Atoms Hit: 0 Atoms Missed: 6
Scoring Formula = (2 × 1) + (0 × -5) + (6 × 5) = 32
This design encourages careful deduction — players must minimize both ray usage and incorrect guesses to achieve the best possible score.
5. Cheat Mode & Debug Tools
Built-in debugging features assist in learning and testing:
Game Physics
Hexagonal Coordinate System
The game uses an axial coordinate system for hexagonal grids
Ray Deflection Physics
Atoms create deflection zones that affect rays passing nearby:
- Deflection Zone: Atoms affect rays in adjacent hexagons
- Deflection Angle: 60° when one atom is nearby
- Double Deflection: 120° when positioned between two atoms
- Reflection: Occurs when an atom is directly adjacent to entry point
Installation & Setup
Prerequisites
- JDK 17 or higher (Amazon Corretto recommended)
- Maven 3.6+
- JavaFX SDK 17+
Installing the Project
# Clone the repository
git clone https://github.com/CiaranMcDonnell/BlackBox.git
cd BlackBox
or
# Download the latest release from GitHub
https://github.com/CiaranMcDonnell/BlackBox/releases/latest/download/BlackBox.jar
Educational Value
Black Box serves as an excellent educational tool for:
- Computational Geometry: Hexagonal grid algorithms and coordinate systems
- Ray Tracing: Basic principles of ray-object interaction
- Game Theory: Strategic decision-making and optimization
- Object-Oriented Design: Clean architecture and design patterns