Single page Trasure Hunt game, implemeted using JavaScript.
The setup stage is initiated when the player clicks on the Start
button. During the setup stage, the player needs to click on the board cells and place obstacles, treasures and a hunter using the following keys:
- `o` for obstacle
- `5`, `6`, `7` or `8` for treasures of different value
- `h` for hunter
The player can move around the board using the keys a
, w
, s
and d
. If they try to move on a cell with an obstacle, they hunter will remian in place. Treasures can be claimed by moving on the treasure cell. When a treasure is taken, the scoreboard updates with the value of the treasure, as well as the number of remaining treasure of the same value. Each valid move will increase the rounds by 1.
The player can end the game whenever they want if they press on the End Game
button. The game automatically ends when the player has taken all treasures or there are no moves available.
Upon ending the game, a popup appears showing the performance of the player. The performance is calculated as the Score / Rounds
round up to 2 decimals. To maximise the performance the player has to find the optimal path to claim all the treasures, without wasting moves.
The player has the option to restart the game, starting again from setting up the game board.