News for hackers. Stuff that matters.
Re:Richard Garriott’s D&D #1 Contest by DanBC on Sunday April 20, 2014 @04:53PM (#7618442)
There are plenty of people on HN who are good programmers / coders [1] and who will never have seen BASIC before.

I am really curious to know what they think of this source code. Is it readable and understandable without access to any kind of BASIC manual? Or are you making use of as much online documentation as you can to grok it?

Re:Richard Garriott’s D&D #1 Contest by tdicola on Sunday April 20, 2014 @05:53PM (#7618619)
BASIC isn't that ancient and should be familiar to anyone who has experience with C. Scanning the code here I don't think there's a lot of insight to be gleaned by studying it in depth. There really aren't any comments and program flow jumps around with GOTO frequently (there are no functions to call) so it's hard to tell what's going on without studying each line. Variable names are very short (1 to 2 characters) and don't tell you a lot about what's going on. If you really want to understand what the code is doing, you're probably going to need to spend a few hours going through it line by line and annotating in the margins where each 'function' is and what each variable means. Once you've done that it's probably best to just rewrite it in C using functions, etc.
Re:Richard Garriott’s D&D #1 Contest by CamperBob2 on Sunday April 20, 2014 @07:45PM (#7618926)
I'd be tempted to just write a quick and dirty interpreter for the BASIC dialect in question. I could almost certainly do that more quickly than I could port that code to C.
Re:Richard Garriott’s D&D #1 Contest by aaronem on Sunday April 20, 2014 @09:33PM (#7619253)
I'm really hoping there's at least one submission which consists of a BBC BASIC interpreter written in C and compiled via asm.js into Javascript, thus satisfying the contest's requirements regarding platforms, and which executes the original BASIC code.

(What I'd really like to see is a PDP-11 emulator written in C and compiled via asm.js, &c., &c., but I doubt anyone seriously pursuing the contest will be quite that insane.)

Re:Richard Garriott’s D&D #1 Contest by trhtrhth on Wednesday April 23, 2014 @09:55PM (#7638107)
Sure. You should know what a for loop is and recognize it. LET X = X + 1 should immediately tell you how they assign values to variables. GOTO 01410 should be obvious that it's going to that line. Math and comparison operators are the same as most languages. 00001 REM (C) 1977-2014 RICHARD GARRIOTT should immediately show that REM is some kind of code comment unless you're insane enough to think the language is going to execute a copyright statement that's preceded by a mysterious 'REM'. READ in a 1 to 7 loop seems to correspond to the dnd stat attributes in the DATA statement above it. Then there's another READ, with 2 variables, in a loop from 1 to 15, which seems to correspond to the 30 other variables in the previous data statement. etc. I have seen BASIC before, though.
Re:Richard Garriott’s D&D #1 Contest by pronoiac on Sunday April 20, 2014 @06:56PM (#7618787)