TransWikia.com

What to make of $!:tt puzzle.!txt$?

Puzzling Asked by humn on September 4, 2021

Puzzling Stack Exchange:

Don’t even ask where I found
the old printout, below, of an uncommented computer program.
As I am a leading-edge software solutionaut
hone-tuned for elegantly annotated exoticode,
reconnoitering this printout is beneath my paygrade.
All I’ve bothered to notice is that some drone
meant this program to spin out something called "puzzle.txt".
I need for you to spec the deets for me.

  Assuming that puzzle.txt is a puzzle, what kind?
How is this program supposed to produce it?

  Know that I am particularly impatient to be debriefed on
the identities of the 7 characters besmirched on line 200.

200 w$(1,0) = ??????? [7 smudged characters]

  It would be really great if you could also
dummy up
a possible printout of puzzle.txt by noon, okay?.

 10  rows = 8 : columns = 8
 20  dim n(rows,columns), f$(rows,columns), w$(rows,columns)
 30  for r = 0 to rows : for c = 0 to columns
 40      n(r,c) = 0
 50      f$(r,c) = "_"
 60      if r=0 then w$(r,c) = "_" else w$(r,c) = "|"
 70  next c : next r
 80  w$(0,columns) = " " : w$(rows,columns) = "_"
 90  d = INT(4*RND) : r = 1+INT(rows*RND) : c = 1+INT(columns*RND)
100  n(r,c) = 1
110  unvisited = rows*columns - 1
120  while unvisited > 0
130      d = INT( d + 3.6 + 2.4*RND ) mod 4
140      if d=3 and c < columns then:  c = c+1 : if n(r,c)=0 then w&dollar;(r,c-1) = "_"
150      if d=1 and c > 1       then:  c = c-1 : if n(r,c)=0 then w&dollar;(r,c)   = "_"
160      if d=0 and r > 1       then:  r = r-1 : if n(r,c)=0 then f&dollar;(r,c)   = " "
170      if d=2 and r < rows    then:  r = r+1 : if n(r,c)=0 then f&dollar;(r-1,c) = " "
180      if n(r,c)=0 then:  n(r,c) = 1 : unvisited = unvisited-1
190  wend
200  w&dollar;(1,0) = ???????  [7 smudged characters]
210  for r = 1 to rows-1 : for c = 1 to columns-1
220      if f&dollar;(r,c)=" " or f&dollar;(r,c+1)=" " then:  if w&dollar;(r,c)="_" then w&dollar;(r,c) = " "
230  next c : next r
240  open "o", #1, "puzzle.txt"
250  for r = 0 to rows : for c = 0 to columns
260          if c > 0 then print #1, f&dollar;(r,c);
270          print #1, w&dollar;(r,c);
280      next c : print #1,""
290  next r : close #1 : end

(Yeah yeah, no this is not
an actual corporate-speak demand for information,
but the challenge is to answer as if it were.
The tag means that
the old program should not be run
in order to figure it out or to make the sample puzzle.txt.)

2 Answers

Let's trace through the code!

So, after setup, we're here:

So, what is that "something"?

Armed with this knowledge, we can finally check out lines 200-230:

A sample output:

Correct answer by Deusovi on September 4, 2021

From the QA Department (solver-led improvements) – Community Wiki, feel free to edit


Test Ø.   A puzzle.txt that could be produced by the posted program were it set to use more rows and columns. It’s ASCII,,, but is it art? Good enough, at least, to solve by hand and test its simplistic puzzle-producing algorithm.



Test D.   puzzle.txt after a revision motivated by Deusovi’s solution. Poof – gone are the excessive horizontal gaps of Test Ø.



Test DF.   puzzle.txt after also following Florian F’s suggestion in a comment. No more rounded corners or excessive vertical gaps. Is it ASCII puzzle art yet?



Appendix DFc.   Code that produced Test DF with its combined improvements while running in QB64 v1.4, a handy version of QuickBASIC made by QB64.org.

Answered by humn on September 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP