My Second React Native Application: A Puzzle Inspired by The Times Crossword Section
Inspired by the puzzle section of The Times newspaper, I built a React Native app featuring an 8x8 grid puzzle with a unique pathfinding challenge.
Puzzle Mechanics
The game consists of an 8x8 grid made up of individual cells. Each puzzle starts with a randomly positioned start and end cell, placed on any of the four walls.
From the start cell, I randomly generate a path that extends until it reaches a wall again. Once generated, the puzzle is validated against a set of constraints—such as minimum track length—to ensure it’s challenging yet solvable.
Automated Puzzle Solving
To verify puzzle solvability, I implemented a backtracking algorithm capable of solving the puzzles quickly thanks to the manageable size of the 8x8 grid and modern computing power.
This solver allows me to test not only complete puzzles but also incomplete ones by systematically removing random pieces and re-running the solver to confirm if the puzzle remains solvable.
Refining Puzzle Difficulty
The next step in puzzle generation is a process of elimination: removing pieces one-by-one while ensuring the puzzle remains solvable. When the solver can no longer find a valid path, the last removal is reverted.
I then check if the puzzle meets difficulty constraints, such as having enough missing pieces to make it a proper challenge. Puzzles that pass these criteria are added to a JSON file for storage.
Batch Generation and Offline Play
Running this generation script for hundreds of puzzles (about 100 per batch) produces a rich set of challenges that are bundled within the React Native app itself.
Storing puzzles locally means the game requires no server communication, allowing players to enjoy it fully offline.
Summary
- Designed an 8x8 grid puzzle inspired by The Times crossword section.
- Implemented random path generation with validation constraints.
- Created a fast backtracking solver to verify puzzle solvability.
- Developed a puzzle refinement algorithm removing unnecessary pieces while maintaining solvability.
- Generated hundreds of puzzles stored locally in JSON, enabling offline play in React Native.