Skip to content

Commit

Permalink
feat: add new puzzle games (#7)
Browse files Browse the repository at this point in the history
* feat: add new puzzle game: nonogram

* feat: add new puzzle game: snake

* docs: add game config examples
  • Loading branch information
5annaha authored May 24, 2024
1 parent 7754a96 commit cbabcae
Show file tree
Hide file tree
Showing 7 changed files with 565 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,6 @@ npm run deploy

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

# Game config examples
See [Game config examples](docs/example_game_configs.md).
73 changes: 73 additions & 0 deletions docs/example_game_configs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Game config examples

## Snake

**game_config example**

* game: snake
* speed: how fast the snake is (bigger the number slower the snake)
* targetSnakeLength: how many 'apples' snake needs to eat

```json
{
"default": {
"game": "snake",
"speed": 8,
"targetSnakeLength": 16,
"endDescription": "All shield segments fixed!",
"initDescription": "<p>Front shield generator shield segments are dirty.</p>\n\t\t<p>Clean up all faulty segments by collecting (red) 'apples' with the remote-controlled snake cleaner. After enough dirt has been cleaned the system will become operational.</p>"
},
"skill:master": {
"game": "snake",
"speed": 12,
"targetSnakeLength": 12,
"endDescription": "All shield segments fixed!",
"initDescription": "<p>Front shield generator shield segments are dirty.</p>\n\t\t<p>Clean up all faulty segments by collecting (red) 'apples' with the remote-controlled snake cleaner. After enough dirt has been cleaned the system will become operational.</p>"
},
"skill:expert": {
"game": "snake",
"speed": 16,
"targetSnakeLength": 8,
"endDescription": "All shield segments fixed!",
"initDescription": "<p>Front shield generator shield segments are dirty.</p>\n\t\t<p>Clean up all faulty segments by collecting (red) 'apples' with the remote-controlled snake cleaner. After enough dirt has been cleaned the system will become operational.</p>"
}
}
```

## Nonogram

**game_config example**

* game: nonogram
* gridWidth: grid width
* gridHeight: grid height
* maxStrikes: how many faulty segments are accepted before they need to redo the task

```json
{
"default": {
"game": "nonogram",
"gridWidth": 5,
"gridHeight": 7,
"maxStrikes": 3,
"endDescription": "All shield segments fixed!",
"initDescription": "<p>Front shield generator shield segments are faulted.</p>\n\t\t<p>You need to find all faulty segments so that EVA can recalibrate using functional segments. Try to avoid faulty ones. When all functional segments are found the recalibration can begin. Each number on the lines outside the grid represents a block of squares to be blacked out in that row or column</p>\n\t\t<p>You may reset the shield segments to a random state.</p>"
},
"skill:master": {
"game": "nonogram",
"gridWidth": 5,
"gridHeight": 5,
"maxStrikes": 3,
"endDescription": "All shield segments fixed!",
"initDescription": "<p>Front shield generator shield segments are faulted.</p>\n\t\t<p>You need to find all faulty segments so that EVA can recalibrate using functional segments. Try to avoid faulty ones. When all functional segments are found the recalibration can begin. Each number on the lines outside the grid represents a block of squares to be blacked out in that row or column</p>\n\t\t<p>You may reset the shield segments to a random state.</p>"
},
"skill:expert": {
"game": "nonogram",
"gridWidth": 4,
"gridHeight": 4,
"maxStrikes": 3,
"endDescription": "All shield segments fixed!",
"initDescription": "<p>Front shield generator shield segments are faulted.</p>\n\t\t<p>You need to find all faulty segments so that EVA can recalibrate using functional segments. Try to avoid faulty ones. When all functional segments are found the recalibration can begin. Each number on the lines outside the grid represents a block of squares to be blacked out in that row or column</p>\n\t\t<p>You may reset the shield segments to a random state.</p>"
}
}
```
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"date-fns": "^1.30.1",
"lodash-es": "^4.17.21",
"onsenui": "^2.10.6",
"p5": "^1.9.3",
"vue": "2.6.14",
"vue-onsenui": "^2.7.2",
"vue-typer": "^1.2.0",
Expand Down
8 changes: 6 additions & 2 deletions src/components/GameScanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ import ManualGame from './games/ManualGame'
import LightsOut from './games/LightsOut'
import FlappyDrone from './games/FlappyDrone.vue'
import ValueBalance from './games/ValueBalance.vue'
import Nonogram from './games/Nonogram.vue'
import Snake from './games/Snake.vue'
import { startWatch, cancelWatch } from '../nfc';
const GAMES = {
Expand All @@ -89,6 +91,8 @@ const GAMES = {
lightsout: LightsOut,
flappy: FlappyDrone,
balance: ValueBalance,
nonogram: Nonogram,
snake: Snake,
}
export default {
Expand All @@ -100,7 +104,7 @@ export default {
gameConfig: {},
config: {},
state: 'scanning',
defaultNotBroken: 'The system is operating nominally',
defaultNotBroken: 'The system is operating normally',
debug: false,
debugCount: 0,
gameLoader: () => undefined,
Expand Down Expand Up @@ -211,7 +215,7 @@ export default {
this.debugCount++
if (this.debugCount >= 5) {
this.debug = true
this.tag = localStorage.getItem('game-tag') || 'game:reactor_1'
this.tag = localStorage.getItem('game-tag') || 'game:impulse_C1'
}
}
},
Expand Down
Loading

0 comments on commit cbabcae

Please sign in to comment.