Skip to content

Commit

Permalink
Merge branch 'main' into refactor/custom-unification
Browse files Browse the repository at this point in the history
  • Loading branch information
byorgey committed Apr 25, 2024
2 parents fd25c6d + a739b14 commit a46f3ab
Show file tree
Hide file tree
Showing 99 changed files with 1,614 additions and 948 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check_todos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: |
scripts/enforce-todo-issues.sh
scripts/validate/issues-for-todos.sh
2 changes: 1 addition & 1 deletion .github/workflows/scenario-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
python -m pip install --upgrade pip
pip install check-jsonschema
- run: |
scripts/validate-json-schemas.sh
scripts/validate/json-schemas.sh
2 changes: 1 addition & 1 deletion .github/workflows/yaml-normalization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ jobs:
- uses: actions/checkout@v3
- name: Normalize
run: |
scripts/normalize-all-yaml.sh
scripts/normalize/yaml.sh
git diff --name-only --exit-code
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ stan.html

.swarm_history

*.db
*.orig
*.aux
*.log
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"data/scenarios/**/*.yaml",
"scenarios/**/*.yaml"
],
"data/schema/terrains.json": [
"data/terrains.yaml"
],
"data/schema/entities.json": [
"data/entities.yaml"
],
Expand Down
1 change: 1 addition & 0 deletions app/doc/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ cliParser =
Data.Foldable.asum
[ pure Nothing
, Just Entities <$ switch (long "entities" <> help "Generate entities page (uses data from entities.yaml)")
, Just Terrain <$ switch (long "terrain" <> help "Generate terrain page (uses data from terrains.yaml)")
, Just Recipes <$ switch (long "recipes" <> help "Generate recipes page (uses data from recipes.yaml)")
, Just Capabilities <$ switch (long "capabilities" <> help "Generate capabilities page (uses entity map)")
, Just Commands <$ switch (long "commands" <> help "Generate commands page (uses constInfo, constCaps and inferConst)")
Expand Down
5 changes: 3 additions & 2 deletions app/doc/Swarm/Doc/Gen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ import Swarm.Doc.Util
import Swarm.Doc.Wiki.Cheatsheet
import Swarm.Game.Entity (Entity, EntityMap (entitiesByName), entityName)
import Swarm.Game.Entity qualified as E
import Swarm.Game.Land
import Swarm.Game.Recipe (Recipe, recipeCatalysts, recipeInputs, recipeOutputs)
import Swarm.Game.Robot (Robot, equippedDevices, robotInventory)
import Swarm.Game.Scenario (GameStateInputs (..), loadStandaloneScenario, scenarioLandscape)
import Swarm.Game.Scenario (GameStateInputs (..), ScenarioInputs (..), loadStandaloneScenario, scenarioLandscape)
import Swarm.Game.World.Gen (extractEntities)
import Swarm.Game.World.Typecheck (Some (..), TTerm)
import Swarm.Language.Key (specialKeyNames)
Expand Down Expand Up @@ -135,7 +136,7 @@ generateSpecialKeyNames =

generateRecipe :: IO String
generateRecipe = simpleErrorHandle $ do
(classic, GameStateInputs worlds entities recipes) <- loadStandaloneScenario "data/scenarios/classic.yaml"
(classic, GameStateInputs (ScenarioInputs worlds (TerrainEntityMaps _ entities)) recipes) <- loadStandaloneScenario "data/scenarios/classic.yaml"
baseRobot <- instantiateBaseRobot $ classic ^. scenarioLandscape
return . Dot.showDot $ recipesToDot baseRobot (worlds ! "classic") entities recipes

Expand Down
8 changes: 6 additions & 2 deletions app/doc/Swarm/Doc/Wiki/Cheatsheet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ import Swarm.Game.Display (displayChar)
import Swarm.Game.Entity (Entity, EntityMap (entitiesByName), entityDisplay, entityName, loadEntities)
import Swarm.Game.Entity qualified as E
import Swarm.Game.Recipe (Recipe, loadRecipes, recipeCatalysts, recipeInputs, recipeOutputs, recipeTime, recipeWeight)
import Swarm.Game.Terrain (loadTerrain, terrainByName)
import Swarm.Language.Capability (Capability)
import Swarm.Language.Capability qualified as Capability
import Swarm.Language.Pretty (prettyText, prettyTextLine)
import Swarm.Language.Syntax (Const (..))
import Swarm.Language.Syntax qualified as Syntax
import Swarm.Language.Text.Markdown as Markdown (docToMark)
import Swarm.Language.Typecheck (inferConst)
import Swarm.Util (listEnums)
import Swarm.Util (listEnums, showT)
import Swarm.Util.Effect (simpleErrorHandle)

-- * Types
Expand All @@ -54,7 +55,7 @@ data PageAddress = PageAddress
deriving (Eq, Show)

-- | An enumeration of the kinds of cheat sheets we can produce.
data SheetType = Entities | Commands | CommandMatrix | Capabilities | Recipes | Scenario
data SheetType = Entities | Terrain | Commands | CommandMatrix | Capabilities | Recipes | Scenario
deriving (Eq, Show, Enum, Bounded)

-- * Functions
Expand All @@ -73,6 +74,9 @@ makeWikiPage address s = case s of
Entities -> simpleErrorHandle $ do
entities <- loadEntities
sendIO $ T.putStrLn $ entitiesPage address (Map.elems $ entitiesByName entities)
Terrain -> simpleErrorHandle $ do
terrains <- loadTerrain
sendIO . T.putStrLn . T.unlines . map showT . Map.elems $ terrainByName terrains
Recipes -> simpleErrorHandle $ do
entities <- loadEntities
recipes <- loadRecipes entities
Expand Down
5 changes: 3 additions & 2 deletions data/scenarios/Challenges/Ranching/gated-paddock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,9 @@ robots:
dir: north
inventory:
- [4, wool]
unwalkable:
- gate
walkable:
never:
- gate
program: |
run "scenarios/Challenges/Ranching/_gated-paddock/meandering-sheep.sw";
entities:
Expand Down
2 changes: 1 addition & 1 deletion data/scenarios/Challenges/Sokoban/_foresight/solution.sw
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def firstLeg =
pushUntilBarrier;

wait 4;
move;
moveUntilBlocked;
doN 5 (turn left; moveUntilBlocked);

turn right;
Expand Down
1 change: 0 additions & 1 deletion data/scenarios/Challenges/_combo-lock/solution.sw
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ def moveToLock =
end;

def cycleCombos = \n.
wait 1;
entityNorth <- scan north;
let hasGate = case entityNorth (\_. false) (\x. x == "gate") in
if hasGate {
Expand Down
2 changes: 1 addition & 1 deletion data/scenarios/Challenges/_word-search/create-puzzle.sw
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def singleTile = \expectedFwdOrdinal. \expectedBkwdOrdinal.
return letterIndex;
end;

def crossBack = \n.
def crossBack = \_n.
currentLoc <- whereami;
teleport self (0, snd currentLoc - 1);
end;
Expand Down
183 changes: 0 additions & 183 deletions data/scenarios/Challenges/_word-search/verify-solution.sw

This file was deleted.

Loading

0 comments on commit a46f3ab

Please sign in to comment.