Commit Graph

731 Commits

Author SHA1 Message Date
Ondřej Šebek
7fc7051c8d Remove create capability 2022-06-16 14:08:40 +02:00
Ondřej Šebek
83a7b6626e
Add robotNumbered command for debugging (#405)
Sometimes I need a dirty and direct way to get the n-th robot in the world quickly.

The name of the command is longer by design so that it does not get confused with the proposed `child` command or custom user definitions.

- part of #343
2022-06-16 11:17:33 +00:00
Brent Yorgey
221e7ec679
Some new devices and recipes (#395)
- Add quartz and quartz mines
- Add `clock`, `silicon`, and `circuit`
- Add `comparator` device
- Metal drills can now drill through boulders too
- Add pixels to the world, and recipes for `camera` and `scanner`

See discussion at https://github.com/swarm-game/swarm/issues/26#issuecomment-1152743741 and https://github.com/swarm-game/swarm/pull/361 .
2022-06-15 16:06:25 +00:00
Brent Yorgey
7a88bc1db6
copy over known (count 0) items when salvaging (#398)
Fixes #391.
2022-06-15 15:53:16 +00:00
Ondřej Šebek
bda16b79ac
Iron (#373)
- add iron ore, iron mine and iron vein (closes #93)
  - split gear into iron/wooden gear
  - add metal drill
  - add faster recipes with the metal drill
- add compass (closes #341)
- handle multiple entities providing the same capability
  - try to find if the robot has at least one entity providing the capability
  - when no entity could provide the capability rejects it too
- list required devices in the `Incapable` error (closes #342)
2022-06-14 16:13:27 +00:00
Brent Yorgey
7ee8d2458b fix module name in comment 2022-06-13 06:23:18 -05:00
Brent Yorgey
2b5bffc6e0 Delete bound variables from capCtx when recursing into terms
Fixes #389.
2022-06-12 17:03:50 -05:00
Brent Yorgey
54e5e35bbe clean up examples
Closes #325.
2022-06-11 15:15:07 -05:00
Ondřej Šebek
d55c6e8bf6
Add note about create (#381)
- add a note about 'create' to the make command
- also fix spacing before punctuation in error messages
2022-06-11 01:53:47 +00:00
Brent Yorgey
2da8cb06e0 tutorial: remove reference to creative mode hotkey
Fixes #360.
2022-06-10 15:40:54 -05:00
Brent Yorgey
6780254b2f
resolve seed every time a scenario is selected to be played (#379)
Seed resolution used to happen in `loadScenarioFile`, but that was the
wrong place.  Resolution now happens in `playScenario`.  This means that, e.g. if you
select "New Game > Classic" from the menu, then quit back to the menu, then start
a second new game, you will get a different random world each time.

Fixes #369.
2022-06-10 10:24:48 +00:00
Brent Yorgey
597d1c6853
require --cheat flag to allow toggling creative mode with m key (#368)
Closes #360.
2022-06-10 00:38:00 +00:00
Brent Yorgey
a5a5832afe
add recipe weights and choose randomly among matching recipes (#372)
Recipes can now optionally have a `weight` (with a default weight of
1).  Any time multiple recipes match the criteria by which we are
selecting a recipe, one of the recipes will be chosen randomly, with
probability proportional to its weight.

As a simple example, drilling a boulder now produces 3 rocks with
probability 3/4 and 4 rocks with probability 1/4.

The ultimate purpose of this is to support some things I would like to propose in relation to mines, iron, etc. but it seems like a useful/interesting feature on its own.
2022-06-09 00:42:29 +00:00
Ondřej Šebek
14c5bdbd04 Move HLint to GHC 8.10.7 in CI
The version check only cares about 8/9
and HLint has some trouble installing
in 9.2, so this avoids it for now.
2022-06-09 01:29:05 +02:00
Ondřej Šebek
dabcb21608 Update stack resolver 2022-06-09 01:29:05 +02:00
Ondřej Šebek
ff9ec66711 Add ci flag to CI
- set -Werror in CI
- fix GHC 9.2 warning about TH looking syntax ($e)
2022-06-09 01:29:05 +02:00
Ondřej Šebek
94c876a01a Add GHC 9.2.3 to CI 2022-06-09 01:29:05 +02:00
Brent Yorgey
69929f1b61 Bump dependency bounds
- bump upper bounds on dependencies
- remove special th-extras and depedent-sum deps
- fix problems with new opaque types in Aeson
2022-06-09 01:29:05 +02:00
Ondřej Šebek
b67a0f3ef4
Enable HLint in CI (#371)
- uncomment HLint configuration in Haskell-CI config
- remove unused pragmas
- remove some unnecessary parens
2022-06-08 22:40:29 +00:00
Ondřej Šebek
9a72bc52a5
Reformat codebase with Fourmolu (#370)
Run
```bash
fourmolu -i $(find . -name '*.hs')
```
2022-06-08 22:32:12 +00:00
Brent Yorgey
128a15ebe8
skip menu and default to classic mode if --run or --seed is given (#364)
Closes #363.  Also addresses the issue discussed in #359 .
2022-06-06 12:23:34 +00:00
Brent Yorgey
7b4ffccb9d
add sand, glass, and calculator (#362)
- Sand is now found near water.  Sand regenerates immediately (like water).
- Sand can be used in a furnace to make glass.
- Glass + copper wires + 3D printer can be used to make solar panels.
    - Note that with #361 I intend to start the base with a small number of 3D printers, so other robots could carry this out.  But also, the base will start with a bunch of solar panels too.
- Solar panel + counter can be used to make a calculator.
2022-06-06 12:17:46 +00:00
Brent Yorgey
ee857a5d21
upgrade to brick-0.69 (#365)
Closes #340.
2022-06-04 22:59:18 -05:00
Ondřej Šebek
161f510f15
Find robots (#339)
* add robotNamed : string -> cmd robot
* add chess knight challenge

In challenges, it's impossible to access the robot
by its assigned number. We do however name it.
Seems reasonable to add a way to get robot by its name.
2022-06-05 00:29:06 +02:00
Ondřej Šebek
7ad65ad00a
Update Github Actions and fix Doctest (#352)
* Fix doctests

* Regenerate haskell-ci with config

- use latest haskell-ci
- configure haskell-ci to use doctest

* Update tested with compiler

- update cabal tested-with field
- update .mergify.yaml to new compiler
  - restore note about mergify in haskell-ci
2022-06-04 15:04:26 -05:00
Brent Yorgey
8578a5675a update tutorial to match changes to the way game is started 2022-06-04 13:56:01 -05:00
Brent Yorgey
3ab402a810 link to the web tutorial from the Tutorial menu 2022-06-04 13:40:01 -05:00
Brent Yorgey
b381bf8272 update README to reflect latest changes 2022-06-04 13:36:45 -05:00
Brent Yorgey
8961d03a1a
Generalize challenges + classic/creative modes to scenarios (#337)
Generalize challenges + various modes to all be "scenarios" which are described by `.yaml` files in `data/scenarios`.  

- Both challenges and classic/creative modes are now subsumed under the more general notion of "scenarios".
- A scenario describes how to set up the world etc. when starting a game; all scenarios are stored in a `.yaml` file in `data/scenarios`.
- "New game" menu item now lets the user choose a scenario.
- Some small improvements to the way seeds are handled.

See #296.  This will enable #35 and #25 .
2022-06-04 13:20:49 +00:00
Ondřej Šebek
a6715e4bbd
Make only base display as Omega (#338)
- make robots look down as 'X'

With base not having any direction
specific characters this just finishes
the job and makes it fully distinct.
2022-05-24 13:48:36 -05:00
Brent Yorgey
42f99435c8 move get closer to where it is used 2022-05-21 15:50:59 -05:00
Brent Yorgey
985a433ed3
Pop up entity description on Enter (#335)
Hitting `Enter` on an inventory item pops up a dialog box with its description.  For items with longer descriptions this is a convenient way to be able to see the whole description without having to scroll the info box in the lower left.

`Enter` used to try to `make` the focused item; that is now accomplished with `m`.
2022-05-21 15:48:54 -05:00
Brent Yorgey
518e5bae1c clear confirmation when quitting
The confirmation modal dialog for quitting used to still be there
after quitting then starting a new game.
2022-05-05 13:18:11 -05:00
Brent Yorgey
c8d0c4bd76
Add a main menu shown on startup (#326)
Lots of refining, adding more menu options, etc. that still needs to happen, but this adds a basic menu.  Quitting a game now quits to the menu rather than quitting the entire application.
2022-05-05 13:08:50 -05:00
Brent Yorgey
bc137386a8
ignore non-top-level VResults (#330)
Fixes #327.
2022-04-30 15:29:21 -05:00
Brent Yorgey
a6e2edbeba
Make the salvage command take one tick to transfer each item (#317)
I initially thought this would be tricky, but it's not: all we need to
do is reprogram the salvaged robot to give the salvaging robot one
item at a time.

Closes #202.
2022-04-29 15:18:37 -05:00
Brent Yorgey
d36a89af18
deal gracefully with absence of git repo (#329) 2022-04-29 05:19:04 -05:00
Brent Yorgey
667f001c8b print git branch and hash in --help menu
Not super useful on its own.  This is mostly just to figure out the
`githash` library (which wasn't hard) in initial preparation for #66.
2022-04-27 08:01:45 -05:00
Brent Yorgey
68d19c1ec2 Don't reset store when executing run command
Fixes #299.
2022-04-16 09:12:17 -05:00
Brent Yorgey
d4aed91997
Add a dialog box to confirm quit (#320)
Closes #77 .  When hitting Ctrl-Q, now a dialog box opens up allowing you to confirm you want to quit or cancel.  The machinery for dealing with pop-up windows is somewhat generalized as well, which should make it easy to add other similar pop-up windows as needed in the future.
2022-03-30 06:39:37 +00:00
Alexander Block
7d2339fdb0
make it impossible to destroy base (#318)
It is now impossible to destroy `base`. In `Step.hs` we now always check whether the current robot is `base` (by checking whether its `robotID` is 0) before the `selfDestruct` flag is set. If it is `base` a `CmdFailed` exception is thrown instead.

This resolves #297 .
2022-03-22 14:59:54 +00:00
Brent Yorgey
b1e2c59b85 create feedback.yaml file
For use with https://github.com/NorfairKing/feedback .
2022-03-19 11:08:35 -05:00
Brent Yorgey
f80c689e5b check in logo image 2022-03-19 09:51:12 -05:00
Brent Yorgey
dbe1574ed9
add built-in 'error' and 'undefined' (#315)
Closes #161.
2022-03-18 17:07:47 +00:00
Brent Yorgey
841db9bac1 update description of modes in README 2022-03-15 21:00:35 -05:00
Brent Yorgey
4a600fa788 update URL repo references from byorgey/swarm to swarm-game/swarm 2022-03-14 14:09:47 -05:00
noahyor
1cf4abd7d3
Add boolean operations like && and || (#307)
Closes #189.
2022-03-11 19:32:54 +00:00
Brent Yorgey
008d4000a5
Add a --run flag to run the contents of a program on startup (#312)
Fixes #82.

Right now it only works in classic mode.  It wouldn't be too hard to
make it work with challenge mode as well, but that would require some
more careful thinking about whether every challenge is required to
have a 'base' and how we identify which robot that is, so that we run
the given file on the right robot.
2022-03-07 05:56:15 -06:00
Brent Yorgey
a78369d7e6
Track whether robots have an ID number or not at the type level (#311)
See the discussion at
https://github.com/byorgey/swarm/pull/303#discussion_r817471340 .
This seems like an unqualified success: no more hacky (-1)'s, and
doing the refactoring actually uncovered a bug!  Previously, we were
not actually assigning ID's to the robots that were read as part of a
challenge.  This means that in a challenge with multiple robots, all
but one of them would instantly disappear since they all shared the
same ID number.
2022-03-06 16:06:51 -06:00
Brent Yorgey
242376d294 Fix Mergify config
Convert deprecated `commit_message` attribute to
`commit_message_template`.  See https://docs.mergify.com/actions/merge/#defining-the-commit-message
2022-03-01 21:02:58 -06:00