https://github.com/lostjared/knights_tour.javascript
Solving Knights Tour in HTML5/JavaScript
https://github.com/lostjared/knights_tour.javascript
javascript knights-tour math puzzle
Last synced: 8 months ago
JSON representation
Solving Knights Tour in HTML5/JavaScript
- Host: GitHub
- URL: https://github.com/lostjared/knights_tour.javascript
- Owner: lostjared
- License: mit
- Created: 2024-05-22T06:51:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-22T13:51:11.000Z (over 1 year ago)
- Last Synced: 2024-12-31T05:17:30.987Z (9 months ago)
- Topics: javascript, knights-tour, math, puzzle
- Language: JavaScript
- Homepage: http://lostsidedead.biz/knights-tour
- Size: 113 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Knight's Tour Demo

This is a simple implementation of the Knight's Tour problem using HTML5 Canvas and JavaScript. The demo visualizes the knight's movement on an 8x8 chessboard, where the knight visits each square exactly once.
## Features
- Visual representation of the Knight's Tour on a chessboard.
- User can press the spacebar to move the knight to the next position.
- User can press the Enter key to reset the tour.## Getting Started
To run this demo, simply open the the directory containing the project
run
```bash
python3 -m http.server 3000
```
open your web browser to localhost:3000### Prerequisites
- A modern web browser (e.g., Chrome, Firefox, Edge).
## Files
- `index.html`: The main HTML file that sets up the canvas and includes the JavaScript file.
- `script.js`: The JavaScript file containing the logic for the Knight's Tour and drawing functions.
- `knight.png`: The image of the knight used in the demo.## Usage
1. Download or clone the repository to your local machine.
2. Open in your web browser over http
3. Use the following keys to interact with the demo:
- `Space`: Move the knight to the next position.
- `Enter`: Reset the Knight's Tour.## Implementation Details
The demo uses HTML5 Canvas to draw the chessboard and the knight. The knight image is processed to remove its white background and is drawn on the board at each step.
This project is open-source and available under the MIT License.