ref: ae73ad76ef95f0e40868436cb750126322051dd0
parent: 84ec2a0a77d63450311f7c25b36d4b9f7e3c53e1
author: Ben Harris <[email protected]>
date: Sat Feb 4 11:50:55 EST 2023
Range: Don't fail an assertion on an all-black board If there are no white squares, then Range's check that all the white squares form a connected component goes wrong. Skip the check in that case to avoid an assretion violation ("edsf_canonify: Assertion `index >= 0' failed."). This can be demonstrated by starting a game with no clues (e.g. "range 3:i") and then filling in every square.
--- a/range.c
+++ b/range.c
@@ -1494,7 +1494,8 @@
if (state->grid[r*w+c] != BLACK &&
state->grid[r*w+(c+1)] != BLACK)
dsf_merge(dsf, r*w+c, r*w+(c+1));
- if (nblack + dsf_size(dsf, any_white_cell) < n) {
+ if (any_white_cell != -1 &&
+ nblack + dsf_size(dsf, any_white_cell) < n) {
int biggest, canonical;
if (!report) {