chiark / gitweb /
Error-highlight loops in Net.
authorSimon Tatham <anakin@pobox.com>
Sun, 28 Dec 2014 12:19:50 +0000 (12:19 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 28 Dec 2014 13:15:31 +0000 (13:15 +0000)
commit546fbe6774ce4c8b630f33a341963a77e1e151e4
treee0550e349109c69e898d61722d8188f73922344c
parent822243de1bc1fc6d26b2f2d0f45616c8f6183058
Error-highlight loops in Net.

Loops are detected using the same dsf technique I ended up using in
Slant, and highlighted in red (whether or not the connected component
they belong to is currently powered).

Should make life a little bit easier for someone who's filled in most
of the grid to a nice uniform cyan and finds one piece left over - now
they have some idea where to start looking for their mistake.

We also take care not to generate any loops in the starting position,
on grounds of politeness (don't accuse the user of a mistake before
they've even had a chance to make one).

Loop detection does not contribute to the code that decides whether
the puzzle is complete, because there's no need - if all squares are
connected together, then there can't be any loops anyway, by graph
theory.
net.c