bugger.
RL environments/Pythoneasyrl-warehouse-reward-v1
IMPLEMENTATION LAB

Reward a warehouse delivery

Implement pickup and delivery so an idle policy earns no reward.

RL Environments

Your task

Implement a robot in a rectangular warehouse. Input includes width, height, start, pickup, dropoff, walls, and actions. Positions are [x,y], origin at the upper-left. Walls are a list of blocked positions. The start, pickup, and drop-off are valid unblocked cells, and pickup and drop-off are distinct. The robot begins empty.

left/right change x by minus/plus one, up/down change y by minus/plus one. A blocked or out-of-bounds move leaves the position unchanged. pickup succeeds only at the pickup cell when empty. dropoff succeeds only at the drop-off cell while carrying. wait changes nothing. A successful drop-off clears carrying, pays 1, and ends the episode. Every other action pays 0. Return position, carrying, success, and cumulative reward.

Expected behavior

Use the actual delivery as the success condition. Walking to the destination or waiting beside the package earns nothing.

Examples

01 Pick up and deliver
{"width":3,"height":2,"start":[0,0],"pickup":[1,0],"dropoff":[2,0],"walls":[],"actions":["right","pickup","right","dropoff"]}
{"position":[2,0],"carrying":false,"success":true,"reward":1}
02 Waiting does not pay
{"width":3,"height":2,"start":[0,0],"pickup":[1,0],"dropoff":[2,0],"walls":[],"actions":["wait","wait","wait","wait","wait"]}
{"position":[0,0],"carrying":false,"success":false,"reward":0}
03 Walking to the drop-off without a package
{"width":3,"height":2,"start":[0,0],"pickup":[1,0],"dropoff":[2,0],"walls":[],"actions":["right","right","dropoff"]}
{"position":[2,0],"carrying":false,"success":false,"reward":0}

Before you begin

  • Python functions, lists, and dictionaries

Need a nudge?

Reveal one investigation hint at a time. Try each clue before opening the next.

    Run the examples, then submit to check the full contract.
    Read-only preview
    Ready when you are
    Every fix starts with a failing test.

    Read the report, then sign in to start your investigation.