HEXBUS -- Pure-Logic Puzzles on a Hex Grid


Proceeds are donated to the Kanata Food Cupboard, providing food assistance for Kanata individuals and families in need. You can pick up a copy on Amazon Canada or US.
HEXBUS I
This first book in the HEXBUS puzzle series introduces 100 puzzles of varying difficulty. Each puzzle features a QR code that allows you to get hints on a particular cell or see the solutions incrementally.
Puzzle hints
- 1 2 3 4 5 6 7 8 9 10
- 11 12 13 14 15 16 17 18 19 20
- 21 22 23 24 25 26 27 28 29 30
- 31 32 33 34 35 36 37 38 39 40
- 41 42 43 44 45 46 47 48 49 50
- 51 52 53 54 55 56 57 58 59 60
- 61 62 63 64 65 66 67 68 69 70
- 71 72 73 74 75 76 77 78 79 80
- 81 82 83 84 85 86 87 88 89 90
- 91 92 93 94 95 96 97 98 99 100
Confirmed TESTS.txt's own "@@@ we'll run out of junctors too!" note, and it's benign.
With only MAX_JUNCTORS (12) shared across up to 72 lines all going off-hook with no
intervening hangups, junctor allocation starts failing partway through the offhook phase
(Line::emit logs "could not allocate a junctor, ignoring event (congestion)" and leaves
that line's ccb NULL, though Line::state still correctly reaches OffHook -- the
state transition happens in Line::scan() before emit() is even called, unconditionally).
The interesting part: later hanging up one of these congestion-denied lines calls
Line::emit(LineEvent_Onhook) with ccb == NULL, and emit()'s ccb-bootstrap prologue
doesn't distinguish why ccb is NULL from what event triggered it -- it unconditionally
treats any event on a CCB-less line as a fresh origination attempt, so a bare Onhook can
momentarily allocate a brand new ccb + junctor + P_Line, exactly as if it were an Offhook.
This is harmless only because every processor (P_Line included) unconditionally
deactivates on CCBEvent_Onhook regardless of what state it's in, so the phantom ccb gets
torn down again in the very same event dispatch, before scan_cc()'s next pass -- confirmed
in the debug log: allocate, dispatch, immediately deactivate, teardown, free, all in one
Line[N]::emit Onhook block. Self-healing, not a leak, and the 12+-lines-congested scenario
this requires never arises outside a stress test like this one -- noted here rather than
"fixed," since there's no observable bug to fix (a guard limiting the ccb-bootstrap
prologue to LineEvent_Offhook specifically would be more obviously correct, but this
phase is about finishing the stress tests, not auditing Line::emit, and the current
behavior is already provably safe).
Verification: -t 9001 standalone clean (both counted above). make wipedb && make reg (110 tests now, -V9001 appended as the final reg line) matches the established
baseline exactly. Grand-total ASAN/UBSAN rebuild clean. Pico cross-build unaffected
(sim_tests.cc is simulator-only, not in CMakeLists.txt's source list) and confirmed to
still build clean.
With this, PLAN.md's Phase 3 step 5 (previously explicitly deferred as optional) is done, and every phase in the plan is now complete.