Skip to content

"Robot registry" allowing access to built/known robots by index #462

Open
@byorgey

Description

[NOTE: see also the comprehensive discussion in #506 .]

I was frustrated today when I forgot to bind the result of build to a variable name and it got me thinking about some related things again. What if every robot has a "registry" of robots that it has built, accessible by "child id"? In particular, I propose:

  • adding a primitive child : int -> robot
  • child n evaluates to the nth child built by the robot evaluating it
  • when printing a robot value, print it in the form child n when possible (this will be most of the time)
  • maybe there could also be friend : int -> robot which is a registry of other robots you know about
  • evaluating some robot which is not a child will cause it to get added to the friend index, so it can be printed as friend k
  • note friend and child indices will be specific to each robot; they will have nothing to do with internal (globally unique) robot ids, which will be completely hidden

Originally posted by @byorgey in #343 (comment)

A suggested recipe for a robot index is counter + logger.

Metadata

Assignees

No one assigned

    Labels

    C-Moderate EffortShould take a moderate amount of time to address.G-RobotsAn issue having to do with robots.L-CommandsBuilt-in commands (e.g. move, try, if, ...) in the Swarm language.S-Nice to haveThe bug fix or feature would be nice but doesn't currently have much negative impact.Z-FeatureA new feature to be added to the game.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions