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

halt command to cancel a robot's running program #392

Closed
byorgey opened this issue Jun 13, 2022 · 2 comments · Fixed by #1256
Closed

halt command to cancel a robot's running program #392

byorgey opened this issue Jun 13, 2022 · 2 comments · Fixed by #1256
Assignees
Labels
C-Low Hanging Fruit Ideal issue for new contributors. G-Robots An issue having to do with robots. L-Commands Built-in commands (e.g. move, try, if, ...) in the Swarm language. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. Z-Feature A new feature to be added to the game.

Comments

@byorgey
Copy link
Member

byorgey commented Jun 13, 2022

Is your feature request related to a problem? Please describe.
Robots can be reprogrammed or salvaged when they are done; but currently there is no way to halt a robot's running program in the middle. This is annoying especially in the case of robots set up to do something forever in an infinite loop. If you messed up the program, or you just decide that you want to do something else now, there's currently no way to stop a robot in an infinite loop.

Describe the solution you'd like
There should be some way to explicitly tell a robot to stop its program. Probably you should (1) need an explicit reference to the robot and (2) be physically close the robot. (If you want to be able to tell robots to halt from far away, well, you can program that yourself once we have #94 .) For example, maybe it can be as simple as a new primitive halt : robot -> cmd () which tells the given robot to halt if it is on the same cell as (or maybe within Manhattan distance 1 of) the robot executing the halt instruction.

Describe alternatives you've considered
I suppose an alternative would be to just say "tough luck, if you wanted to be able to cancel a robot program then you should have programmed that in from the beginning", with some kind of cancellable_forever function that has some built-in polling to see whether it should quit or keep going. But that would be pretty annoying. No one can plan perfectly for the future.

@byorgey byorgey added Z-Feature A new feature to be added to the game. C-Low Hanging Fruit Ideal issue for new contributors. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. G-Robots An issue having to do with robots. L-Commands Built-in commands (e.g. move, try, if, ...) in the Swarm language. labels Jun 13, 2022
@byorgey
Copy link
Member Author

byorgey commented Jun 28, 2022

Idea: have halt provided by a halting oracle device. Proposed description:

A device to solve the halting problem. When asked if a particular robot program will halt, it always answers YES. And it is always correct. Or else.

@TristanCacqueray
Copy link
Collaborator

I like it. Perhaps we could also introduce a chaitin constant entity to make the oracle recipe :)

@byorgey byorgey self-assigned this Mar 2, 2023
@byorgey byorgey mentioned this issue May 13, 2023
@mergify mergify bot closed this as completed in #1256 May 19, 2023
mergify bot pushed a commit that referenced this issue May 19, 2023
Closes #392 .  Adds a command `halt : actor -> cmd unit` which halts the given robot if it is within a distance of 1 (no distance limit for system robots or in creative mode).  `halt self` works too.  Privileged robots (i.e. system robots, or when in creative mode) can halt any other robot.  Unprivileged robots cannot halt system robots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Low Hanging Fruit Ideal issue for new contributors. G-Robots An issue having to do with robots. L-Commands Built-in commands (e.g. move, try, if, ...) in the Swarm language. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. Z-Feature A new feature to be added to the game.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants