Towards #1043. The eventual goal of this sublibrary split is to have a self contained library that can compose 2D grids of arbitrary content (perhaps colored pixels, or boolean values). This could be useful outside of the `swarm` game. I would also like to write unit tests for the structure recognizer that are independent of the `Entity` type. # Major Changes ## Direction module * Moved `Swarm.Language.Syntax.Direction` to `swarm-util`, since both `swarm-lang` and `swarm-topology` depend on it, but not on each other. * Removed the re-export of direction things from `Swarm.Language.Syntax` ## Structure module The `Swarm.Game.Scenario.Topography.Structure` module has been split into two: * `Swarm.Game.Scenario.Topography.Structure` * `Swarm.Game.Scenario.Topography.Structure.Type` The former retains the YAML parsing logic. The latter is agnostic of `Enitiy` type and the palette . At some future point, I might want to move the YAML parsing to this sublibrary while still retaining independence of `Entity` type. ## Structure recognizer The structure recognizer is independent of the content of Cells (i.e. it does not need to know what an `Entity` is), except: 1. during initialization 2. when retrieving the original cell content after recognition Type parameters for three kinds of data have been added to the recognizer: 1. `Cell`/`PCell` 2. `Entity` 3. `EntityName` Eventually it may be possible to eliminate one or two of these type parameters, with some refactoring. |
||
---|---|---|
.github | ||
.vscode | ||
app | ||
data | ||
docs | ||
editors | ||
example | ||
images | ||
scripts | ||
src | ||
test | ||
tournament | ||
web | ||
.gitignore | ||
.hlint.yaml | ||
.mergify.yml | ||
.restyled.yaml | ||
.stan.toml | ||
cabal.haskell-ci | ||
CHANGELOG.md | ||
CODE_OF_CONDUCT.md | ||
COMMUNITY.md | ||
CONTRIBUTING.md | ||
cspell.json | ||
DESIGN.md | ||
feedback.yaml | ||
fourmolu.yaml | ||
hie.cabal.yaml | ||
hie.stack.yaml | ||
LICENSE | ||
NOTICE | ||
pull_request_template.md | ||
README.md | ||
scenarios | ||
stack.yaml | ||
swarm.cabal |
Swarm
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.
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.
-
Clone the Swarm repository, e.g.
git clone https://github.com/swarm-game/swarm.git
-
If you don't already have the
cabal
tool:-
Get the
ghcup
tool, a handy one-stop utility for managing all the different pieces of a Haskell toolchain. -
Use
ghcup
to install a supported version of GHC:ghcup install ghc 9.6.4
-
Use
ghcup
to installcabal
:ghcup install cabal
-
-
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.) -
Go get a snack while
cabal
downloads and builds all of Swarm's dependencies. -
You might also want to check out the
scripts
directory, which contains an assortment of useful scripts for developers.