Resource gathering + programming game
Go to file
Karl Ostmo 099b95fab4
Support a generic "original" payload in structure recognizer (#2216)
The recognizer algorithm operates on a `NonEmptyGrid` of `Maybe` elements.  However, there may exist some progenitor object with auxiliary metadata payload that is independent of the algorithm but should be presented along with the final recognized structure.

So long as an "extraction" function is provided that derives the nonempty grid of `a`s from the original object `b`, we can send `b` along for the ride through the algorithm without concern to `b`'s internals.

# Changes

Overall this refactoring makes the code more generic and simpler.

* Build the recognizer automata at scenario parse time
* Enforce grid no emptiness earlier in recognizer construction
* Subsume redundant `_structureDefs` member of `StaticStructureInfo` record with `_staticAutomatons` field
* Make some type signatures in the UI more generic
* Push the conversion from `Cell` to `Entity `further up the pipeline
* Remove some derived `Show` instances (`show`-ing a Scenario is not likely to be useful due to sheer volume of content)
2024-12-04 00:46:45 +00:00
.github Add github action for Restyled (#2166) 2024-10-11 16:24:37 +00:00
.vscode Move top-level Github/VSCode configuration files (#2037) 2024-07-14 15:41:23 +02:00
app render map preview as dynamic PNG (#2184) 2024-10-18 23:56:51 +00:00
data ensure no overlaps in initial placement of recognized structures (#2212) 2024-11-29 15:52:32 +00:00
docs topography sublibrary (#1836) 2024-06-02 20:53:34 +00:00
editors subworld-aware teleportation and location query commands (#2195) 2024-10-21 02:26:47 +00:00
example Benchmark Dictionary implementation in Swarm (#2191) 2024-11-21 21:27:26 +00:00
images 0.4 release blog post (#1444) 2023-08-22 12:35:05 -05:00
scripts exterminator scenario (#2126) 2024-11-02 21:54:11 +00:00
src Support a generic "original" payload in structure recognizer (#2216) 2024-12-04 00:46:45 +00:00
test ensure no overlaps in initial placement of recognized structures (#2212) 2024-11-29 15:52:32 +00:00
tournament render map preview as dynamic PNG (#2184) 2024-10-18 23:56:51 +00:00
web Migrate to v8 of pixi.js, vendor the library (#2144) 2024-09-15 00:57:40 +00:00
.gitignore Move top-level Github/VSCode configuration files (#2037) 2024-07-14 15:41:23 +02:00
.hlint.yaml navigable robots table (#2140) 2024-09-17 18:28:06 +00:00
.stan.toml exclude some stan observations 2021-09-15 06:39:21 -05:00
CHANGELOG.md 0.6 release (#1980) 2024-07-15 19:05:42 +00:00
CODE_OF_CONDUCT.md update references from IRC -> Discord (#2029) 2024-07-13 14:29:25 +00:00
COMMUNITY.md update references from IRC -> Discord (#2029) 2024-07-13 14:29:25 +00:00
CONTRIBUTING.md fix markdown link (#2067) 2024-07-21 17:44:22 +00:00
DESIGN.md More minor edits (#693) 2022-09-18 12:04:33 +00:00
feedback.yaml Don't set it variable when an exception was raised (#1922) 2024-06-10 19:14:45 +00:00
fourmolu.yaml World description DSL (#1376) 2023-08-17 11:08:42 +00:00
LICENSE Update copyright (#1973) 2024-06-23 03:59:08 +00:00
NOTICE Use a new opaque type for robots instead of strings (#303) 2022-03-02 03:00:44 +00:00
README.md 0.6 release (#1980) 2024-07-15 19:05:42 +00:00
scenarios Documentation for scenario file format (#612) 2022-07-30 08:02:11 -04:00
swarm.cabal Support a generic "original" payload in structure recognizer (#2216) 2024-12-04 00:46:45 +00:00
weeder.toml better transparency handling for structure recognizer (#2115) 2024-08-16 20:14:15 +00:00

Swarm

Build Status GitHub release (latest by date) Swarm release on Hackage Contributor Covenant ircchat GitHub Contributors

Swarm is a 2D programming and resource gathering game. Program your robots to explore the world and collect resources, which in turn allows you to build upgraded robots that can run more interesting and complex programs. More info can be found on the Swarm website.

World 0 after scanning a tree and making a log.

Contributing

See CONTRIBUTING.md for information about various ways you can contribute to Swarm development!

Building

If you just want to play the game, head over to the Swarm website for installation instructions. If you want to build Swarm from source (e.g. in order to contribute, or to test out the latest bleeding-edge unreleased features), read on.

  1. Clone the Swarm repository, e.g.

    git clone https://github.com/swarm-game/swarm.git
    
  2. If you don't already have the cabal tool:

    1. Get the ghcup tool, a handy one-stop utility for managing all the different pieces of a Haskell toolchain.

    2. Use ghcup to install a supported version of GHC:

      ghcup install ghc 9.8.2
      
    3. Use ghcup to install cabal:

      ghcup install cabal
      
  3. Now use cabal to build and run Swarm:

    cd /path/to/the/swarm/repo
    cabal run -O0 swarm:exe:swarm
    

    (Note that we recommend turning off optimizations with -O0 since they don't seem to make much difference to the speed of the resulting executable, but they make a big difference in compilation time.)

  4. Go get a snack while cabal downloads and builds all of Swarm's dependencies.

  5. You might also want to check out the scripts directory, which contains an assortment of useful scripts for developers.