Delivery: Logging, Cancelling Orders, Distances

Hello,

One question regarding logging: There is a log regarding actively driving (containing distance driven etc.). Should this log also be used while the driver is returning to the restaurant after the delivery?

And also 2 questions regarding the delivering logic itself:

  1. If a group gives up on an order, is the driver notified in some way and turns around or does he still do the entire trip and just log a failure when arriving?
  2. We have to log the travelled distance in kilometers. Should this be computed as deliveryDistance * (travelledTicks / deliveryDuration) where a deliveryDuration of 0 needs to be treated separately? And should the result always be rounded up if needed?
1 Like

No, no need.

A customer group decides to “give up waiting” if their delivery has not arrived by 3 ticks after its expected arrival time. However, the driver continues driving and logs their progress normally. Upon arrival, the driver attempts to give the group the meals, but because the group has already given up, the delivery fails, prompting a Delivery Failed log. Only after this failed attempt is made does the driver begin the return journey to the restaurant. So the driver is not stopping midway and going back.

  • The total duration of a delivery in ticks is calculated as ⌈distance/5⌉.

  • During each driving tick, the driver logs the cumulative distance driven in kilometers ($delivery:distance km) alongside the remaining ticks ($delivery:ticks).

  • The driver returns to the restaurant covering the same distance and duration.

1 Like

Thank you!

I understand the first 2 points but I’m still uncertain about the third one.

The cumulative distance up until a certain point has to be computed via a fraction based on how many ticks of the delivery duration, the driver has already driven. E.g. if the delivery distance is 9km, then the delivery duration is 2 ticks. Meaning that 1 tick is equivalent to 4.5km.

Should we actually use the exact decimal number that we computed for logging or should we e.g. always round up to the next integer (i.e. 5 in this case)?

Hi,

as per the example you mentioned, you should log 5 km for the first time as that is the maximum distance covered in a tick and in the next tick, the log should be the total distance, which is 9 in this case (5+4=9).

2 Likes

Hi,

just to make sure we understand this correctly. What should be logged for a distance of 13 km and how would the calculation work for this example? One tick would be equivalent to 4.3 km in this case.

For a total distance of 13 km, the driver will drive and log 5 km in the first tick, 10 km in the second tick, and then 13 km in the third tick.

The maximum amount a driver can drive in a single tick is 5km, after the driver drove 10 km, 3 km is left so it is logged 13km. There is no rounding.

2 Likes

We suspect that, in the reference implementation, the logging of driving is not working as described here.
It seems that it always logs 5km.

Hi,

This is not the case. Please check the replies above for the correct logging.

1 Like

Hallo,
for the returning part to the restuarant after the delivery is given also should we log the delivery driving ?
thank you

No, you should not. Look at the first answer to my original post here.

1 Like

Update from an Office Hour: The maximum distance a driver can drive per tick is completely independent of the total delivery distance.

In one tick, the driver will always drive an additional 5km, unless the remaining distance to drive is less than 5.

I.e. for a delivery distance of 6 (which takes 2 ticks):

in the first tick after getting the order, the driver will log having driven 5km.

In the tick afterwards, he will log a total of 6km.