MCPcopy Index your code
hub / github.com/braziljs/eloquente-javascript / score

Function score

code/solutions/07_2_robot_efficiency.js:17–19  ·  view source on GitHub ↗
({route, pickUp})

Source from the content-addressed store, hash-verified

15 // Route length counts negatively, routes that pick up a package
16 // get a small bonus.
17 function score({route, pickUp}) {
18 return (pickUp ? 0.5 : 0) - route.length;
19 }
20 route = routes.reduce((a, b) => score(a) > score(b) ? a : b).route;
21 }
22

Callers 1

lazyRobotFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected