This is one working solution. Read it, then try writing your own version.
No successful run recorded.
Write these in the editor below. End commands with ;. Keep ? on commands that can fail.
More commands & Rust basics
let part = ...; names a value so you can use it later. Lines starting with // are comments; the robot ignores them. ? stops the program and shows the error if an action fails. Write only the function body; the game supplies the surrounding function.
}
SHIP API REFERENCE
ship.go(x, y)?Travel vertically, then horizontally. Grid: x 0–7, y 0–4. Each tile costs 1 + cargo count energy.
ship.step(dx, dy)?Move one adjacent tile. Loaded weak tiles add 25 damage. At 100 damage the run stops.
ship.scan(x, y)Reading { fragile: bool, component: Option<Kind> }. Scanning costs one action, zero energy.
ship.recover()?Returns owned Component { kind, value, mass }. Requires a part at your tile and a free rack slot.
ship.inspect(&part)Borrows a Component and returns its value.
ship.install(part)?Consumes the component at dock (0,2). Restores the matching ship system.
ship.log("message")Add a message to the flight recorder. Kind variants: Battery, Alloy, Coolant, Core.
Functions, structs, Vec, iterators, and all standard Rust syntax work from the start. 400 simulation actions; 2.5 seconds execution. Errors display compiler line numbers with a two-line wrapper offset.