From e607482867385c0d71a097e0b7ba8e61719e9285 Mon Sep 17 00:00:00 2001 From: Sara Gerretsen Date: Mon, 22 Sep 2025 00:44:06 +0200 Subject: [PATCH] fix: operator< Cell Cell now sorts by y first, then x --- src/simulation.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/simulation.cpp b/src/simulation.cpp index 0b97b33..b8720af 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp @@ -185,8 +185,7 @@ bool operator!=(Cell const &lhs, Cell const &rhs) { } bool operator<(Cell const &lhs, Cell const &rhs) { - uintptr_t hashl{ uintptr_t(lhs.x * 73856093) ^ uintptr_t(lhs.y * 19349663) }; - uintptr_t hashr{ uintptr_t(rhs.x * 73856093) ^ uintptr_t(rhs.y * 19349663) }; - return hashl < hashr; + if (lhs.y == rhs.y) return lhs.x < rhs.x; + else return lhs.y < rhs.y; } }