🥣How it works
The How
How It Works
Command Input: A command (e.g., “Move Up One Step”) is given.
State Transition: Robot status changes to moving.
Movement: Position updates by one unit, within boundary rules.
Battery Use: Battery decreases (e.g., −1 per move).
State Reset: Returns to idle after completing or blocking a move.
Collision Check: Invalid moves trigger a collision flag.
Status Output: Updated status (position, battery, state, collision) is returned.
Rules & Constraints
Step Size: One command = one unit of movement.
Boundaries: Position must remain within defined X/Y limits.
Battery: Never below 0; no movement allowed when empty.
Collision: Invalid moves trigger a flag; behavior depends on chosen mode.
Extensibility: Robot size, abilities, and sensors can affect logic.
Example Status: { "position": [5,5], "battery": 3, "state": "idle", "collision": false } Command: “Move Right One Step”
state → moving
position → [6,5]
battery → 2
state → idle
collision → false
If the next command exceeds boundaries, position won’t update, collision = true, and status reflects that outcome.
Last updated