HP Forums
The challenge: BASIC program which produce the same on LIST or RUN - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not remotely HP Calculators (/forum-9.html)
+--- Thread: The challenge: BASIC program which produce the same on LIST or RUN (/thread-11516.html)



The challenge: BASIC program which produce the same on LIST or RUN - sasa - 10-03-2018 05:21 AM

One of the best logical/programmer's challenge I can remember, was published in one of the first computer magazines in the country about 3 decades ago, had following short definition (paraphrased):

"Make the shortest BASIC program which produce exactly the same output on RUN or LIST, i.e. the program which list himself. In the program is forbidden to use LIST, PEEK, POKE, USR or similar commands specific for the implementation - it is allowed to use only standard BASIC commands and functions."

From today perspective, it looks to me almost naive, even the problem itself is basically not naive at all. I remember I have also applied solution and received some reward for shortest solution based on strings. I remember of this with strong nostalgia - good old pioneers days!

Perhaps solution of this challenge may be possible as well on some old HP calculator models have implemented BASIC?

Have a nice fun!


RE: The challenge: BASIC program which produce the same on LIST or RUN - Thomas Klemm - 10-03-2018 07:35 AM

Cf. Quine

Cheers
Thomas


RE: The challenge: BASIC program which produce the same on LIST or RUN - sasa - 10-03-2018 08:07 AM

(10-03-2018 07:35 AM)Thomas Klemm Wrote:  Cf. Quine

Cheers
Thomas

The article is an overkill for valid and short solutions in BASIC.
It is forbidden by definition to use LIST inside the program.

The solution with files is obvious and valid one. However, there is other two differently based approaches, on what the challenge aims...