Skip to content

Commit 5bc1d52

Browse files
committed
Initial commit.
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.
0 parents  commit 5bc1d52

File tree

4 files changed

+531
-0
lines changed

4 files changed

+531
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# vscode files
2+
.vscode/
3+
debug
4+
5+
# build
6+
loopover.exe

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Loopover Challenge in Go
2+
3+
This is a port of spdskatr's loopover_oo.py script.
4+
5+
## How to play
6+
```
7+
18 22 23 4 3
8+
7 24 1 16 8
9+
17 21 20 12 25
10+
2 5 9 6 15
11+
10 19 13 11 14
12+
Move: $
13+
```
14+
15+
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:
16+
17+
```
18+
1 2 3 4 5
19+
6 7 8 9 10
20+
11 12 13 14 15
21+
16 17 18 19 20
22+
21 22 23 24 25
23+
Solved!
24+
```
25+
26+
But here is the catch: you can only move a row or a column of numbers, for example:
27+
28+
```bash
29+
# Moving the third row from the top by 1
30+
1 2 3 4 5 1 2 3 4 5
31+
6 7 8 9 10 6 7 8 9 10
32+
[11 12 13 14 15] --> [15 11 12 13 14]
33+
16 17 18 19 20 16 17 18 19 20
34+
21 22 23 24 25 21 22 23 24 25
35+
36+
# Moving the first column from the left by 2
37+
| 1| 2 3 4 5 |16| 2 3 4 5
38+
| 6| 7 8 9 10 |21| 7 8 9 10
39+
|11|12 13 14 15 --> | 1|12 13 14 15
40+
|16|17 18 19 20 | 6|17 18 19 20
41+
|21|22 23 24 25 |11|22 23 24 25
42+
```
43+
44+
## Possible moves
45+
46+
- `shuffle`: shuffles the board. You probably want to do this before anything else.
47+
- `reset`: resets the board to its original state and sets the moves done back to 0.
48+
- programmer's notation: allows to modify the board. See the "Programmer's Notation" section below to learn more about it.
49+
50+
## Programmer's Notation
51+
```js
52+
// TODO(netux): add programer's notation syntax
53+
```
54+
55+
You can see the Wirth syntax notation of the Programmer's Notation in line 21 of loopover.go

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module go-dev.netux.site/shell/loopover-challenge

0 commit comments

Comments
 (0)