Skip to content

Commit

Permalink
docs: add spaceship
Browse files Browse the repository at this point in the history
  • Loading branch information
sor4chi committed Jun 28, 2024
1 parent d40ce80 commit 19854fa
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
6 changes: 6 additions & 0 deletions notes/sor4chi.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ ou scored some points for using the echo service!
`get lambdaman`を送信。

[これが帰ってきた](./lambdaman/intro.md)

### [2:42] `get speaceship`する

`get spaceship`を送信。

[これが帰ってきた](./spaceship/intro.md)
43 changes: 43 additions & 0 deletions notes/spaceship/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Welcome to the Spaceship course!

In 2020, most of us have learned how to operate a spaceship. In this course we'll play a small chess-like game featuring the spaceship! The game operates on an infinite 2D chess board, with the spaceship initially located on `(0,0)`. The spaceship has a velocity `vx` and `vy`, which are initially both set to `0`. In each turn the player can increase/decrease each of those numbers by at most one, and then the piece moves `vx` steps to the right and `vy` steps up.

Moves are represented with a single digit, inspired by the old numeric pad on a computer keyboard that we used to have in the old days on Earth. For example, `7` means decreasing `vx` and increasing `vy` by `1`, while `6` means increasing `vx` by `1` and keeping `vy` the same. A path can then be represented by a sequence of digits, e.g. the path `236659` visits, in this order, the following squares: `(0,0) (0,-1) (1,-3) (3,-5) (6,-7) (9,-9) (13,-10)`.

Now the challenge is the following: given a list of squares to be visited, find a sequence of moves that visits all those squares. our solution may consist of at most `10,000,000` moves.

The following levels are available:
* [spaceship1] Best score: 5.
* [spaceship2] Best score: 49.
* [spaceship3] Best score: 10.
* [spaceship4] Best score: 99.
* [spaceship5] Best score: 119.
* [spaceship6] Best score: 123.
* [spaceship7] Best score: 94.
* [spaceship8] Best score: 104.
* [spaceship9] Best score: 260.
* [spaceship10] Best score: 405.
* [spaceship11] Best score: 8192.
* [spaceship12] Best score: 8192.
* [spaceship13] Best score: 31744.
* [spaceship14] Best score: 210.
* [spaceship15] Best score: 43.
* [spaceship16] Best score: 1975.
* [spaceship17] Best score: 440.
* [spaceship18] Best score: 1959.
* [spaceship19] Best score: 15323.
* [spaceship20] Best score: 4186.
* [spaceship21] Best score: 4243.
* [spaceship22] Best score: 1359.
* [spaceship23] Best score: 385814.
* [spaceship24] Best score: 799788.
* [spaceship25] Best score: 894411.

To submit a solution, send an ICFP expression that evaluates to:

```
solve spaceshipX moves
```

our score is the number of moves, so a lower score is better.

0 comments on commit 19854fa

Please sign in to comment.