WOW! Excellent stuff. This surely brings back a lot of memory from my early BASIC days.
Here's a tribute to the ever lasting memory of GW-BASIC.
I wrote the following code a while back. It is no where near obfuscated, but it was fun to write.
#!/usr/local/bin/perl -w
while(<DATA>){chomp,m/^(\d+)\s+(.*)/,$p[$1]=$2}
{redo if ($p[++$pc] eq undef); if($p[$pc]=~
/^(?:\s)*FOR\s+(\w+)(?:\s)*=(?:\s)*(\d+)(?:\s)*TO(?:\s)*(\d+)/x
){$var{$1}=[$pc,$2,$3];}elsif($p[$pc]=~/^(?:\s)*PRINT\s+'(.*)'/x
){print "$1\n";}elsif($p[$pc]=~/^(?:\s)*NEXT\s+(\w+)/x){die
"variable $1 not defined!" if !$var{$1};$var{$1}->[1]++;$pc=$var
{$1}->[0] if $var{$1}->[1]<=$var{$1}->[2];}elsif($p[$pc]=~
/^(?:\s)*END/x){exit}redo}
__DATA__
10 REM ****** BASIC PROGRAM *******
20
30 FOR I = 1 TO 5
40 FOR J = 1 TO 5
50 PRINT 'I LOVE GW-BASIC!'
60 NEXT J
70 NEXT I
80
90 END
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.