Welcome to the Logic Lab, a Java-based suite of classic algorithmic puzzles. Instead of just reading code, you can play and solve these challenges yourself directly from your terminal!
- Clone & Compile:
javac Main.java java Main
- Select a Challenge: Choose from the menu to start a session.
- Solve: Input your moves (e.g.,
1 3to move a disk from Peg 1 to Peg 3 in Tower of Hanoi) and the system will validate your logic in real-time.
-
N-Queens Solver: Try to place
$N$ queens on the board without any of them attacking each other. The system will highlight illegal placements. -
Tower of Hanoi: Can you move the stack in the minimum number of moves? (
$2^n - 1$ ) -
8-Puzzle Tile: Use your arrow keys or coordinates to slide tiles into the correct order.
-
Missionaries & Cannibals: A text-based survival game. Choose who gets on the boat, but don't let the missionaries be outnumbered!
-
Tic-Tac-Toe: Play against a friend or test your luck against our Minimax AI.
-
Map-Coloring: Assign colors to different "provinces" and see if you can complete the map without touching identical colors.
To make this user-friendly and maintainable, each problem is structured around three core Java classes:
Board.java: Handles the visual representation, rendering the grid or game state to the console.Validator.java: Contains theisValidMove()logic—the "brain" that enforces the rules of the toy problem.GameEngine.java: Manages the game loop, processesScannerinput, and updates the state.
This project is licensed under the MIT License - see the LICENSE file for details.