MCPcopy Index your code
hub / github.com/NetHack/NetHack / distmin

Function distmin

src/hacklib.c:656–669  ·  view source on GitHub ↗

distance between two points, in moves */

Source from the content-addressed store, hash-verified

654
655/* distance between two points, in moves */
656int
657distmin(coordxy x0, coordxy y0, coordxy x1, coordxy y1)
658{
659 coordxy dx = x0 - x1, dy = y0 - y1;
660
661 if (dx < 0)
662 dx = -dx;
663 if (dy < 0)
664 dy = -dy;
665 /* The minimum number of moves to get from (x0,y0) to (x1,y1) is the
666 * larger of the [absolute value of the] two deltas.
667 */
668 return (dx < dy) ? dy : dx;
669}
670
671/* square of Euclidean distance between pair of pts */
672int

Callers 15

fill_zooFunction · 0.85
worm_crossFunction · 0.85
teledsFunction · 0.85
drag_ballFunction · 0.85
findtravelpathFunction · 0.85
mattackmFunction · 0.85
thitmonstFunction · 0.85
stock_room_goodposFunction · 0.85
find_friendsFunction · 0.85
score_targFunction · 0.85
dog_moveFunction · 0.85
launch_objFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected