From 32c1d0e56d1e09d0c8684e2a14919517831ce8d9 Mon Sep 17 00:00:00 2001 From: Catalin Constantin Mititiuc Date: Sun, 21 Dec 2025 16:30:35 -0800 Subject: [PATCH] Pull collection out of function --- html/images/space.svg | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/html/images/space.svg b/html/images/space.svg index 6090f26..e2dd591 100644 --- a/html/images/space.svg +++ b/html/images/space.svg @@ -360,18 +360,16 @@ return hc <= shipRadius; } - function detectCornerCollision([xc, yc], corners) { - return corners.some(([x, y]) => { - cornerPt.x = x - xc; - cornerPt.y = y - yc; + function detectCornerCollision([xc, yc], [x, y]) { + cornerPt.x = x - xc; + cornerPt.y = y - yc; - return shipBody.isPointInFill(cornerPt); - }); + return shipBody.isPointInFill(cornerPt); } function detectCollisions(position, walls, edges) { return [ - [walls, wall => detectCornerCollision(position, wall)], + [walls, wall => wall.some(corner => detectCornerCollision(position, corner))], [edges, edge => detectEdgeCollision(position, edge)] ].some(([t, f]) => t.some(f)) }