From b39851d1abbaf4f02eecb46096da82a44a89a792 Mon Sep 17 00:00:00 2001 From: Brent Yorgey Date: Sun, 28 Apr 2024 12:12:22 -0500 Subject: [PATCH] Some small updates and fixes (#1806) A few minor updates: - Fix formatting of code snippet in `Elmer's glue` entity description - Fix type in conditional tutorial that referred to `robot` instead of `actor` - Help now describes ctrl-q as "quit or restart" - Update crash tutorial log message with hint about the static we will see if we salvage the currently viewed robot --- data/entities.yaml | 5 ++++- data/scenarios/Tutorials/conditionals.yaml | 4 ++-- data/scenarios/Tutorials/crash-secret.sw | 12 ++++++++---- src/Swarm/TUI/View.hs | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/data/entities.yaml b/data/entities.yaml index cbc8f73ce..512792e24 100644 --- a/data/entities.yaml +++ b/data/entities.yaml @@ -356,7 +356,10 @@ The infix operator `++ : text -> text -> text`{=snippet} can be used to concatenate two text values. For example, - | - "Number of widgets: " ++ format numWidgets + ``` + let numWidgets = 42 + in "Number of widgets: " ++ format numWidgets + ``` properties: [pickable] capabilities: [concat] - name: caliper diff --git a/data/scenarios/Tutorials/conditionals.yaml b/data/scenarios/Tutorials/conditionals.yaml index 08d00316a..2ac2ff4d1 100644 --- a/data/scenarios/Tutorials/conditionals.yaml +++ b/data/scenarios/Tutorials/conditionals.yaml @@ -40,7 +40,7 @@ objectives: of type, say, `{int}`{=type}, we just surround a value of type `int`{=type} in curly braces, like `{3}`. This is why arguments to `build` must also be in curly braces: the type of `build` - is `{cmd a} -> cmd robot`{=type}. + is `{cmd a} -> cmd actor`{=type}. - | **TIP:** Note that `if` requires a `bool`{=type}, not a `cmd bool`{=type}! So you cannot directly say `if (ishere "very small rock") {...} {...}`{=snippet}. @@ -50,7 +50,7 @@ objectives: - | **TIP:** the two branches of an `if` must have the same type. In particular, `if ... {grab} {}`{=snippet} is not - allowed, because `{grab}` has type `{cmd text}`{=type} whereas `{}` has type `{cmd unit}`{=type}. + allowed, because `{grab}` has type `{cmd text}`{=type} whereas `{}`{=snippet} has type `{cmd unit}`{=type}. In this case `{grab; return ()}` has the right type. condition: | try { diff --git a/data/scenarios/Tutorials/crash-secret.sw b/data/scenarios/Tutorials/crash-secret.sw index 6fe259240..0e8509b07 100644 --- a/data/scenarios/Tutorials/crash-secret.sw +++ b/data/scenarios/Tutorials/crash-secret.sw @@ -56,8 +56,12 @@ end; log "Hi, I am secret"; iterate allOK (tryGive - $ "Send a robot to `salvage` me and come back to `give base \"Win\"`.\n" - ++ "When the rescue robot stands where I am and executes `salvage`,\n" - ++ "all my inventory and logs will go to it, including the \"Win\".\n" - ++ "Once you have brought the \"Win\" to your base, you will win!" + $ "Send a robot to `salvage` me and come back to\n" + ++ "`give base \"Win\". When the rescue robot stands\n" + ++ "where I am and executes `salvage`, all my inventory\n" + ++ "and logs will go to it, including the \"Win\". Once you\n" + ++ "have brought the \"Win\" to your base, you will win!\n\n" + ++ "NOTE: if you are still viewing me when I am salvaged,\n" + ++ "you will be in for a surprise! If this happens just\n" + ++ "type `view base` to return to viewing your base." ) diff --git a/src/Swarm/TUI/View.hs b/src/Swarm/TUI/View.hs index f32f999e6..70f608fe2 100644 --- a/src/Swarm/TUI/View.hs +++ b/src/Swarm/TUI/View.hs @@ -826,7 +826,7 @@ helpWidget theSeed mport = , ("Ctrl-o", "single step") , ("Ctrl-z", "decrease speed") , ("Ctrl-w", "increase speed") - , ("Ctrl-q", "quit the current scenario") + , ("Ctrl-q", "quit or restart the current scenario") , ("Ctrl-s", "collapse/expand REPL") , ("Meta-h", "hide robots for 2s") , ("Meta-w", "focus on the world map")