An open API service indexing awesome lists of open source software.

https://github.com/codehunt101/knight-bfs

Coding challenge that randomly generates the starting and ending locations for the knight. Users can manually click on the chess board to move the knight to the ending location, or use the help button so that it automatically moves the knight step by step until it reaches the ending location.
https://github.com/codehunt101/knight-bfs

algorithms-and-data-structures javascript react ruby ruby-on-rails

Last synced: 9 months ago
JSON representation

Coding challenge that randomly generates the starting and ending locations for the knight. Users can manually click on the chess board to move the knight to the ending location, or use the help button so that it automatically moves the knight step by step until it reaches the ending location.

Awesome Lists containing this project

README

          

# Knight Chess Game coding challenge

## Instructions

1. Clone this repository.

2. Please make sure you are using **Ruby 2.7.4**, otherwise go to *Gemfile* and change the ruby version to the one you currently have. Then please run:

```
bundle install
```

3. To install all the react dependencies, please run:
```
npm install --prefix client
```

4. To call the server run:

```
rails server
```

5. Run the following to start the game in the browser:
```
npm start --prefix client
```

## Structure (MVC)

### Models & Controllers
The *Rails* server handles the entire logic of game from the **Game** model (*Game.rb*). The information is sent to the Client from **Api::V1::GamesController** (*games_controller.rb*) as JSON. The manual play mode is handled from the client.

### Views
The components structure is the following:

```
App.js
|
|-->GameControl.js
|
|-->ChessBoard.js
|
|-->Tile.js
```

*index.css* contains the stylings and layout

## Recent major implementations
- Help button calls a *Breadth First Search* algorithm to find the shortest path to the final target location.

## Improvement Opportunities
- Add a Rails backend for more features such as, data persistance, and user login.
- Add more stylings and improve responsiveness.
- Further code refactoring.
- Add tests to minimise bug occurrences.

Thank you for your time!