-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements the basic game mechanics, an UI and the commands "shuffle", "reset" and moving with the programmer's notation. Also added is a README.md with instructions on how to play.
- Loading branch information
0 parents
commit 5bc1d52
Showing
4 changed files
with
531 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# vscode files | ||
.vscode/ | ||
debug | ||
|
||
# build | ||
loopover.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Loopover Challenge in Go | ||
|
||
This is a port of spdskatr's loopover_oo.py script. | ||
|
||
## How to play | ||
``` | ||
18 22 23 4 3 | ||
7 24 1 16 8 | ||
17 21 20 12 25 | ||
2 5 9 6 15 | ||
10 19 13 11 14 | ||
Move: $ | ||
``` | ||
|
||
You are presented with a grid like the one above, your goal is to get all the numbers ordered from lower to higher, starting from the top left and ending on the bottom right, like this: | ||
|
||
``` | ||
1 2 3 4 5 | ||
6 7 8 9 10 | ||
11 12 13 14 15 | ||
16 17 18 19 20 | ||
21 22 23 24 25 | ||
Solved! | ||
``` | ||
|
||
But here is the catch: you can only move a row or a column of numbers, for example: | ||
|
||
```bash | ||
# Moving the third row from the top by 1 | ||
1 2 3 4 5 1 2 3 4 5 | ||
6 7 8 9 10 6 7 8 9 10 | ||
[11 12 13 14 15] --> [15 11 12 13 14] | ||
16 17 18 19 20 16 17 18 19 20 | ||
21 22 23 24 25 21 22 23 24 25 | ||
|
||
# Moving the first column from the left by 2 | ||
| 1| 2 3 4 5 |16| 2 3 4 5 | ||
| 6| 7 8 9 10 |21| 7 8 9 10 | ||
|11|12 13 14 15 --> | 1|12 13 14 15 | ||
|16|17 18 19 20 | 6|17 18 19 20 | ||
|21|22 23 24 25 |11|22 23 24 25 | ||
``` | ||
|
||
## Possible moves | ||
|
||
- `shuffle`: shuffles the board. You probably want to do this before anything else. | ||
- `reset`: resets the board to its original state and sets the moves done back to 0. | ||
- programmer's notation: allows to modify the board. See the "Programmer's Notation" section below to learn more about it. | ||
|
||
## Programmer's Notation | ||
```js | ||
// TODO(netux): add programer's notation syntax | ||
``` | ||
|
||
You can see the Wirth syntax notation of the Programmer's Notation in line 21 of loopover.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module go-dev.netux.site/shell/loopover-challenge |
Oops, something went wrong.