This project implements a Boggle Solver with a TypeScript backend API and a React frontend UI. It finds all valid words in a given Boggle board using a provided word list.
The project is divided into two main parts:
api
: The backend API built with Node.js and Expressui
: The frontend UI built with React and TypeScript
- Node.js (v12 or higher)
- npm (comes with Node.js)
- yarn (optional, but recommended)
-
Clone the repository:
git clone <repository-url> cd CSNW
-
Install dependencies for both API and UI:
cd api && yarn install cd ../ui && yarn install
-
Navigate to the API directory:
cd api
-
Start the API server:
yarn start
The API will be available at
http://localhost:3001
.
-
Navigate to the UI directory:
cd ui
-
Start the React development server:
yarn start
The UI will be available at
http://localhost:3000
.
- Open your browser and go to
http://localhost:3000
. - You can upload a custom word list or use the default one.
- Enter letters into the Boggle board or import matrices.
- Click "Solve" to find all valid words in the Boggle board.
The MatrixImporter
component allows users to import multiple Boggle matrices in JSON format.
Features:
- Accepts pasted JSON input of 4x4 matrices
- Validates the input format and structure
- Provides error messages for invalid input
- Displays a sample JSON format for reference
Usage:
- Paste a JSON array of 4x4 matrices into the text area
- Click "Import Matrices" to validate and import the matrices
Example JSON format:
[
[
["B", "N", "C", "D"],
["E", "I", "G", "H"],
["I", "A", "R", "L"],
["M", "R", "O", "D"]
],
[
["Q", "F", "X", "A"],
["P", "L", "U", "Y"],
["W", "E", "T", "M"],
["K", "S", "V", "H"]
]
]
The WordListUploader
component allows users to upload a custom word list to be used for solving Boggle boards.
Features:
- Accepts CSV file uploads
- Displays the selected file name
- Provides feedback on upload success or failure
- Shows a sample CSV format for reference
Usage:
- Click "Choose file" to select a CSV file containing the word list
- Click "Upload Word List" to send the file to the server
NOTE: There is no backend data persistence.
On API restart the default word list will replace any previously uploaded word lists.
Example CSV format:
air
aim
arm
bar
bard
bird
car
card
chair
char
POST /upload-word-list
: Upload a custom word list (CSV format)POST /solve-matrices
: Solve one or more Boggle matrices
-
Navigate to the API directory:
cd api
-
Run the tests:
yarn test