Implements #345
When Ctrl-D is received by `handleREPLEvent`, it checks if the prompt is empty (for both `CmdPrompt` and `SearchPrompt` cases). If it is empty, it calls `toggleModal`.
I'm new to Haskell in general, so if there's a better way to do this, please let me know.
- note how to install Fourmolu and run it from shell
- refactor the conventions to use subsections for easier readability
- simplify restyled arguments for Fourmolu 0.4
- adds `PolyUnit` pattern (just seemed useful?)
- persists the last type/value into the `REPLDone (Maybe (Polytype, Value))` constructor
- `value` is not needed right now, but I'm thinking about using it for #304
- I'm also considering if pretty-printing the last value in that cozy corner could also be a good idea
- notion of the "active" type (last or currently-executing) and the corresponding `Getter`: `replActiveType`
- show this active type in the REPL UI (fixes#692)
The goal is to make the move tutorial more interesting, by using multiple objectives in sequence:
- _move twice_ (the current **Moving, part 1**) teaches the `move` command
- _move six times_ (**new**) will teach about using <kbd>↑</kbd> to get previous commands in REPL and chaining with `;`
- _turn and move_ (part of the current **Moving, part 2**) teaches the `turn` command and `left`/`right`
- _repeat_ (part of the current **Moving, part 2**) will let the player enjoy reusing previous commands
The map of the next part will be revealed (🪄🧙) upon fulfilling the objective.
```
+--+
|> |
+--+
```
move seven times:
```
+--+------+
| > |
+--+------+
```
turn and move:
```
+--+
| |
+ |
| |
| |
+--+---+ +
| >|
+--+------+
```
repeat:
```
+---------+
| |
| +------+
| |
| |
| +---+--+
| ^|
+------+ |
| |
| |
+--+---+ +
| |
+--+------+
```
---
<sup>The number of moves and the shape itself is subject to change. 😉 </sup>
- when `datadir` is not available, try using the XDG data directory
This way the game can be installed as an executable and data files unpacked to `~/.local/share/swarm/data`.
Notice that the XDG data folder is `~/.local/share/swarm`; inside it is the unpacked `data`.
The alternative approach is to use the environment variable `swarm_datadir` and set that to the unpacked data folder.
That works (even after this change) but is not very beginner friendly.
Ideally, we would like to set this in Cabal when building executable, for example to `/usr/share/swarm/<version>`.
Reading through haskell/cabal#5997, it looks like that is not supported.
When writing scenarios, specifying the direction for system robots is annoying.
With this change robots without direction will have a default direction `down`.
Remove a couple challenges which were just there as placeholders (`test` and `drill_test`; the latter is now moved to `Testing`), and add more interesting `2048` and `hanoi` challenges.
Closes#635 .
Fixes#682.
I still don't understand why it was doing the thing before where it repeated each challenge twice, instead of just repeating the same challenge over and over again. So that has me a little worried. But I do understand why there was a problem --- because when we win a scenario, the menu automatically advances to the next one, but the `currentScenarioPath` is still the one we just won, as it should be so we can save the updated `ScenarioInfo` associated to the correct scenario. But then the menu is rebuilt in order to get all the updated `ScenarioInfo` --- so we must be sure to carefully preserve whatever scenario the menu is focused on, which may or may not be the same as the one we just exited, depending on whether we won or just quit.
- make sure that when the hypothetical robot crashes the game does not
- allow system robots to pick up anything
- let self teleporting robots touch themselves