swarm-game / swarm

Resource gathering + programming game
Other
820 stars 51 forks source link

"DSL challenges" that make commands available for use #778

Open byorgey opened 1 year ago

byorgey commented 1 year ago

It occurred to me that a cool kind of challenge is if you are provided with a dictionary of definitions that you can use, but you can't make any additional definitions. So in other words you have to use the "domain specific language" you're given. Something would need to change to enable this, but I'm not quite sure what. Putting this issue here mostly as a placeholder for now.

xsebek commented 1 year ago

I love this idea! Adding a definition store to robots will help us with storing games too. (#50)

I think we can already do this except for loading the definitions from the scenario since we can just not give you a dictionary.

@byorgey maybe what you meant is adding a "requirement erasure"? Something like:

robots:
  base:
    definitions:
      jump: 'system {l <- whereami; o <- whichwaydoilook; teleport self (fst l + fst o, snd l + snd o)}'

We could allow system: {a} -> a to erase the requirements only in the definitions and otherwise require CGod. For item requirements we could make system create those or pass them through.

xsebek commented 1 year ago

As a concrete example, there is the chess horse challenge, which currently works by setting the initial robot direction to [2,-1].

With this, we could implement it properly by adding a definition of make_move: text -> cmd () which would take the chess move notation as a parameter.

So instead of silly turning right and left, we could make_move "Ne4". :horse_racing:

byorgey commented 2 months ago

I think "requirement erasure" is one piece of this but it's a separate issue.