boB Stepp (4) [Avatar] Offline
Section 7 of listing 2.6 on page 49: This is the final stage of adding additional tunnels to those caves needing them to bring up the tunnels per cave to 3 for each cave. However, in doing so, the code does not make these tunnels two-way. If this is done, then potentially other caves that already have their full complement of three tunnels may now exceed this after the two-way addition.

Another issue with the code as is, is that a check is not made for a tunnel referencing its originating cave. Thus, you could have cave 0 having tunnels [0, 2, 3], which I perceive as illogical.

An interesting question is how to satisfy these additional constraints (all tunnels two-way, no tunnels having the same number as the cave you are in) and keep the number of tunnels per cave constant for all caves. I have not been able to figure out this one as of yet.
boB Stepp (4) [Avatar] Offline
Alas! I should have finished reading the chapter before making my earlier post. The author speaks of both one-way tunnels and tunneling back to themselves on suggesting different cave structures on page 69. Sorry about that Mr. Briggs!