This repository has been archived by the owner on Jul 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget spaceship.txt
46 lines (38 loc) · 2.11 KB
/
get spaceship.txt
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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. Your 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: 207.
* [spaceship5] Best score: 119.
* [spaceship6] Best score: 417.
* [spaceship7] Best score: 115.
* [spaceship8] Best score: 109.
* [spaceship9] Best score: 532.
* [spaceship10] Best score: 797.
* [spaceship11] Best score: 8192.
* [spaceship12] Best score: 129126.
* [spaceship13] Best score: 111684.
* [spaceship14] Best score: 908.
* [spaceship15] Best score: 78.
* [spaceship16] Best score: 2858.
* [spaceship17] Best score: 839.
* [spaceship18] Best score: 3518.
* [spaceship19] Best score: 23614.
* [spaceship20] Best score: 5952.
* [spaceship21] Best score: 5868.
* [spaceship22] Best score: 5351.
* [spaceship23]
* [spaceship24]
* [spaceship25]
To submit a solution, send an ICFP expression that evaluates to:
```
solve spaceshipX moves
```
Your score is the number of moves, so a lower score is better.