Reward a warehouse delivery
Implement pickup and delivery so an idle policy earns no reward.
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
{"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}{"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}{"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.
Read the report, then sign in to start your investigation.