Solve the no connection puzzle: Difference between revisions

Content added Content deleted
m (→‎unannotated solutions: fixed typos.)
m (→‎unannotated solutions: added/changed comments and whitespace.)
Line 1,387: Line 1,387:
subs=subs + 1; !._.subs=__
subs=subs + 1; !._.subs=__
end /*#*/
end /*#*/
!._.0=subs /*assign the number of the node paths. */
!._.0=subs /*assign the number of the node paths. */
end /*nodes*/
end /*nodes*/
pegs=nodes-1 /*the number of pegs to be seated. */
pegs=nodes-1 /*the number of pegs to be seated. */
_=' ' /*_ is used for indenting the output. */
_=' ' /*_ is used for indenting the output.*/
do a=1 for pegs; if ?('A') then iterate
do a=1 for pegs; if ?('A') then iterate
do b=1 for pegs; if ?('B') then iterate
do b=1 for pegs; if ?('B') then iterate
Line 1,409: Line 1,409:
end /*b*/
end /*b*/
end /*a*/
end /*a*/
say /*display a blank line to the screen. */
say /*display a blank line to the terminal.*/
s=left('s',cnt\==1) /*handle the case of plurals (or not). */
s=left('s',cnt\==1) /*handle the case of plurals (or not).*/
say 'found ' cnt " solution"s'.' /*display the number of solutions found.*/
say 'found ' cnt " solution"s'.' /*display the number of solutions found*/
exit /*stick a fork in it, we're all done. */
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
/*──────────────────────────────────────────────────────────────────────────────────────*/
?: parse arg node; nn=value(node)
?: parse arg node; nn=value(node)