Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add print + erase commands, and a challenge scenario showing off print #2245

Merged
merged 13 commits into from
Jan 3, 2025

Conversation

byorgey
Copy link
Member

@byorgey byorgey commented Dec 29, 2024

This PR is a complement/follow-up to #2224 .

  • Add a new print : Text -> Cmd Text command which consumes a paper entity and produces an entity named paper: <text> where <text> is the given text to be printed on the paper
  • Add an erase : Text -> Cmd Unit command which takes a printed-on paper entity and erases it back to a plain paper
  • Add a challenge scenario necessitating the use of print

Especially eager to hear feedback from anyone who wants to try solving the new scenario!

./scripts/play.sh --scenario data/scenarios/Challenges/telephone.yaml

@byorgey byorgey mentioned this pull request Dec 30, 2024
@kostmo
Copy link
Member

kostmo commented Dec 31, 2024

Especially eager to hear feedback from anyone who wants to try solving the new scenario!

Am not sure how to obtain the water to make the paper, since I can't wade into the water to grab it.

@byorgey
Copy link
Member Author

byorgey commented Dec 31, 2024

Am not sure how to obtain the water to make the paper

@kostmo maybe you need to refresh yourself with Tutorials/require.yaml 😄

@kostmo
Copy link
Member

kostmo commented Dec 31, 2024

@byorgey byorgey added the CHANGELOG Once merged, this PR should be highlighted in the changelog for the next release. label Dec 31, 2024
@kostmo
Copy link
Member

kostmo commented Jan 1, 2025

Again, I've abstained from peeking at the solution, but now I'm stuck on how to give the paper to the shuttle robot. I lack copper or iron to craft a grabber.

@byorgey
Copy link
Member Author

byorgey commented Jan 1, 2025

Again, I've abstained from peeking at the solution, but now I'm stuck on how to give the paper to the shuttle robot. I lack copper or iron to craft a grabber.

Ah, you're not supposed to give it, just drop it at the terminal (in the center of the square at the end of the track) and it will pick it up. I'll try to change the description to make this more clear.

Copy link
Member

@kostmo kostmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice challenge. Here's my solution.

toErase <- ensureItem paperName "erase"
(paperName /= "paper")
`holdsOrFail` ["That is already blank!"]
("paper: " `T.isPrefixOf` paperName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems fragile in some way to use an "in-band" indicator for erasability and printability, in that it must be inferred by the entity's name. Perhaps instead we want to define a "printable" property? Then we could have different printable entities like "papyrus", "clay", "whiteboard". Each of them can still be subject to the name transformation with the colon. A property called "printable" would be inherent to the "unmarked" entity, whereas the property called "erasable" would be dynamically set once the entity undergoes a "print".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that's a nice idea. Let me play with that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kostmo What do you think? I decided to just go with a single property printable that determines whether something can be both printed and erased. Having a separate property erasable didn't seem to make sense to me since it's not something that would make sense to set on base entities, and the only reason to erase something is that you previously printed on it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this does mean that you can still print on something that has been previously printed on, like this:

> print "paper" "3"
it0 : Text = "paper: 3"
> print "paper: 3" "7"
it1 : Text = "paper: 3: 7"

That's a bit strange, perhaps, but I don't think it's really a problem.

Copy link
Member

@kostmo kostmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few suggestions

@byorgey
Copy link
Member Author

byorgey commented Jan 3, 2025

@kostmo thanks! Also, I saw you asked why we had to redefine mountain but then removed it. Presumably you figured out that it was to make the mountains get drawn on top of the shuttle, so it looks like it's going through a tunnel. However, I wondered about the opaque property. Currently it only affects the scout command, but I wonder about making opaque also imply that the entity should be drawn with a higher priority than robots? But perhaps having opaque mean several different things is just asking for trouble.

@kostmo
Copy link
Member

kostmo commented Jan 3, 2025

but I wonder about making opaque also imply that the entity should be drawn with a higher priority than robots? But perhaps having opaque mean several different things is just asking for trouble.

I would be in favor of having the opaque property affect the display. It is consistent with the physical interpretation w.r.t. the scout command.

@byorgey byorgey added the merge me Trigger the merge process of the Pull request. label Jan 3, 2025
@mergify mergify bot merged commit c3a83b1 into main Jan 3, 2025
15 checks passed
@mergify mergify bot deleted the feature/print branch January 3, 2025 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CHANGELOG Once merged, this PR should be highlighted in the changelog for the next release. merge me Trigger the merge process of the Pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants