chiark / gitweb /
Net: fix completion check if top left square is empty.
authorSimon Tatham <anakin@pobox.com>
Sun, 12 Mar 2017 09:11:43 +0000 (09:11 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 12 Mar 2017 09:11:43 +0000 (09:11 +0000)
commit0bcb32c9132020ffe2985b542951b05c6ab58b2a
tree1fd8c9b2368851b7647e88433dd052664e8521e4
parent1f613ba31f2599bf29c35d5a46cc81594f6844ea
Net: fix completion check if top left square is empty.

A hand-typed grid is permitted to use the square type '0' (never
generated by Net's own grid generator), which is a completely empty
square. This requires an adjustment to the completion checker, so that
such squares aren't required to be connected; otherwise, a grid
containing one would be permanently uncompletable.

However, the completion checker missed one case - it was
unconditionally checking that all squares are connected to the _top
left corner_, on the basis that (before I thought of the zero square)
any source square is as good as any other if what you really want to
know is whether they're all connected to each other. But that means
that if the top left square _is_ the empty one, things to wrong - e.g.
5x5:02c328ade11adb129d7c3e524 would fail to give a completion flash.

Fixed by starting the completion-checking search from the first
non-empty square we find.
net.c