5 ms·
reading old C like this, I always wonder how could people code like this back then but apparently it was transpiled from fortran. So I'd assume the original cod
by larrykwg 9y ago
reading old C like this, I always wonder how could people code like this back then but apparently it was transpiled from fortran. So I'd assume the original code looked better. I dug around and found it, for comparison here is the original rooms.f vs. rooms.c:
https://paste.ubuntu.com/25458063/ https://paste.ubuntu.com/25458063/
https://github.com/mgius/zork/blob/master/rooms.c https://github.com/mgius/zork/blob/master/rooms.c
Here is the full fortran code: http://gunkies.org/wiki/Zork#Source_code http://gunkies.org/wiki/Zork#Source_code
- ajross 9y agoPretty sure the fortran was itself a port. My apocryphal memory is that the original is for some custom system, which wikipedia tells me was "MDL". The fortran was the result of it being carried to more common systems.
- ghaff 9y agoYes. The Infocom games were written in MDL, which was a LISP derivative.
- digi_owl 9y agoAnd developed on a PDP-11 almost too the end of the company...
- abecedarius 9y agoWeren't they using a 10? I don't remember but it'd at least be surprising not to while they were still at MIT.
- digi_owl 9y agoAh yes, my bad. And it is not even that long since i read the history on Filfre. Guess i have been reading so much about the 11 i got the two mixed...
- abecedarius 9y agoThe 11 had such a pretty instruction set, though it was kinda small for developing a program like Zork.
- ghaff 9y agoI think they eventually had a TOPS-20.
- jghn 9y agoOne of the gnarliest code bases I ever worked in was a very large C project where the inner core had been run through a f2c transpiler. Over the subsequent decade the surrounding code was a hodgepodge of people taking their own interpretations of autogenerated C code because folks didn't question why the code looked the way it did and thus they did their best to maintain the same look and feel. Oh and no one really knew how that original inner core worked, there were no docs, no oral tradition, and it was over 20 years old. While I was still working there we accumulated enough major change requests to the application that finally got the go ahead to throw the original code base out and start from scratch.
- emddudley 9y agoThe download links at http://gunkies.org/wiki/Zork#Source_code http://gunkies.org/wiki/Zork#Source_code are all broken.
- larrykwg 9y agoatleast this one worked: http://simh.trailing-edge.com/games/dungeon.zip http://simh.trailing-edge.com/games/dungeon.zip (Bob's port to Fortran)
- DonHopkins 9y agoThe original MDL source code is beautiful to read: https://github.com/itafroma/zork-mdl https://github.com/itafroma/zork-mdl
- larrykwg 9y agothanks I hope thats the end of that rabbithole, that MDL almost looks like XML neat: https://github.com/itafroma/zork-mdl/blob/master/rooms.mud#L827 https://github.com/itafroma/zork-mdl/blob/master/rooms.mud#L...
- pkaye 9y agoHonest question as someone who never got comfortable with Lisp languages. Is the code in parser.mud easy to read. One of those 100 line functions, could you jump to the middle of it and start understanding the meaning as someone familiar with C like languages? Even though I can figure out the syntax it looks like line noise to me but perhaps it is because i've not done much Lisp coding.
- jsnell 9y agoI wouldn't call that code easy to read, and that's coming as someone who has actually at some point learned enough MDL to actually know the syntax rather than have to reverse engineer it on the spot. There's a couple of reasons why that code is rough to read today: - It's doing very complicated operations that operate on mutable global data, and structuring it as huge and deeply nested functions rather than splitting the operations up to smaller chunks with meaningful names. But you'd see exactly the same kind of thing in non-Lisp source code of that era; it's just different sensibilities. - The code is incredibly heavy on conditionals. Which makes sense given the problem domain: parsing a pseudo-natural language. But MDL is a language where the conditionals kind of suck. COND is basically unreadable in any Lisp, you'd very rarely see people use it today. In CL you'd have more readable options like IF, WHEN and UNLESS. In MDL the only option is misusing short-circuiting AND/OR as a poor man's IF. Which they do in places, which doesn't help readability either. - The use of angle brackets makes everything look like a sea of less-/greater -than comparisons. At least I just can't help it. It's especially bad when combined with the array indexing syntax.
- michaelcampbell 9y agoWhat version of c used integer and logical as type decls?