Journal clone53421's Journal: Self-modifying code (wat) in MS GW-BASIC 3.23
1 REM my super cool game
2 ON ERROR GOTO 6551
51 GOTO 6552965529
61 PRINT "game over!"
62 END
521 ON ERROR GOTO 52529
522 PRINT "wat";
523 GOTO 1652916529
651 PRINT "you lose!"
652 GOTO 61
6551 RESUME 521
16529 LOCATE
16551 IF ERL>0 AND ERL<65529 THEN PRINT "you win!"
16621 GOTO 61
52529 PRINT "the universe is broken!"
52659 RESUME 65129
65129 PRINT "you divided by zero didn't you!"
65529 GOTO 651
+1 internets to anyone who can figure out (and accurately describe) what it outputs, how it self-modifies, or in general just about anything about it worth knowing. Hint: the GW-BASIC tokenizer is doing weird things.
Self-modifying code (wat) in MS GW-BASIC 3.23 More Login
Self-modifying code (wat) in MS GW-BASIC 3.23
Slashdot Top Deals