The Daily WTF
Follow
CodeSOD: Quite a Distance from the Right Solution
Fritz's team sought to determine if a point was within a specified distance from a central point. A common approach would be a direct distance calculation. However, the provided code implements a less conventional method, assuming a lack of understanding of traditional distance metrics. The function iterates through all integer coordinates within a square bounding box defined by the radius. It checks if any of these iterated coordinates match the central point. This approach effectively checks for a square area, not a circular radius in the Euclidean sense. The code uses a brute-force iteration over potential positions. This method is considered a creative, albeit unusual, solution. The author expresses admiration for this novel approach.