Earlier quoted context omitted.
This is C89 style code where you couldn't declare the loop variables in the for loop, as in "for (OBJECT * obj = ... ". There's no problem with this code. The obj variable is initialized in the forEachObject macro which expands to a for loop. (Pretty damn sure - I haven't actually looked up the definition). The array iteration code is also solid. Seems like a pretty good programmer, judging from the code you cite her…
> The array iteration code is also solid. Shouldn't there be a NULL at the end of the array and do a null check in the iteration?
How to program a text adventure in C (2016)
21–30 of 36 posts
Re: How to program a text adventure in C (2016)
#22This programmer, Mr. Ruud Helderman, is like Cool McCool, "Danger is my business!". For example, the parser, function matchParam: OBJECT *obj; par->tag = src; par->distance = *src == '\0' ? distNoObjectSpecified : distUnknownObject; forEachObject(obj) ... The initialization of the obj variable received an obliviate spell. Also function parseAndExecute (). The way he deal with invalid input is, epic: static const COMM…
Re: How to program a text adventure in C (2016)
#23It's ok, but inform 6 is better for this.
But then, why this tutorial? Why write an adventure game using a general-purpose programming language? Because doing so can be entertaining, challenging and educational. The programming language C may not be the most obvious choice for writing a text adventure; it's nothing like LISP-based languages like MDL and ZIL. But while writing my own humble text adventure, I learned that C fits the bill quite well.
Re: How to program a text adventure in C (2016)
#24Ask HN: what's a good JS (browser focused) text adventure engine? I see me making a text adventure (adding one mini chapter) each day as a good lockdown project. Note: I might call it "Everything is better in quarantine." The goal would be to (not) go mad.
Re: How to program a text adventure in C (2016)
#25This programmer, Mr. Ruud Helderman, is like Cool McCool, "Danger is my business!". For example, the parser, function matchParam: OBJECT *obj; par->tag = src; par->distance = *src == '\0' ? distNoObjectSpecified : distUnknownObject; forEachObject(obj) ... The initialization of the obj variable received an obliviate spell. Also function parseAndExecute (). The way he deal with invalid input is, epic: static const COMM…
Re: How to program a text adventure in C (2016)
#26This programmer, Mr. Ruud Helderman, is like Cool McCool, "Danger is my business!". For example, the parser, function matchParam: OBJECT *obj; par->tag = src; par->distance = *src == '\0' ? distNoObjectSpecified : distUnknownObject; forEachObject(obj) ... The initialization of the obj variable received an obliviate spell. Also function parseAndExecute (). The way he deal with invalid input is, epic: static const COMM…
There are phases programmers go through. One phase occurs about after 10 years of professional programming. I call this the "no mercy" phase, where these newly-minted senior programmers think defensive programming is for noobs, and scrunch their C code down to the fewest number of lines and characters. And when someone objects, the reply is, paraphrased (as seen in the replies): "You're just not as good a programmer as me." Sadly, it takes another 10 years for this arrogance to dissipate.
Re: How to program a text adventure in C (2016)
#27This programmer, Mr. Ruud Helderman, is like Cool McCool, "Danger is my business!". For example, the parser, function matchParam: OBJECT *obj; par->tag = src; par->distance = *src == '\0' ? distNoObjectSpecified : distUnknownObject; forEachObject(obj) ... The initialization of the obj variable received an obliviate spell. Also function parseAndExecute (). The way he deal with invalid input is, epic: static const COMM…
You have people literally defending uncommented, unclear code in your replies. There are phases programmers go through. One phase occurs about after 10 years of professional programming. I call this the "no mercy" phase, where these newly-minted senior programmers think defensive programming is for noobs, and scrunch their C code down to the fewest number of lines and characters. And when someone objects, the reply i…
Re: How to program a text adventure in C (2016)
#28This programmer, Mr. Ruud Helderman, is like Cool McCool, "Danger is my business!". For example, the parser, function matchParam: OBJECT *obj; par->tag = src; par->distance = *src == '\0' ? distNoObjectSpecified : distUnknownObject; forEachObject(obj) ... The initialization of the obj variable received an obliviate spell. Also function parseAndExecute (). The way he deal with invalid input is, epic: static const COMM…
You have people literally defending uncommented, unclear code in your replies. There are phases programmers go through. One phase occurs about after 10 years of professional programming. I call this the "no mercy" phase, where these newly-minted senior programmers think defensive programming is for noobs, and scrunch their C code down to the fewest number of lines and characters. And when someone objects, the reply i…
Have you taken a look at some major C codebases? It's not justification but an appeal to authority seems pretty unnecessary :)
Re: How to program a text adventure in C (2016)
#29Ask HN: what's a good JS (browser focused) text adventure engine? I see me making a text adventure (adding one mini chapter) each day as a good lockdown project. Note: I might call it "Everything is better in quarantine." The goal would be to (not) go mad.
Re: How to program a text adventure in C (2016)
#30Ask HN: what's a good JS (browser focused) text adventure engine? I see me making a text adventure (adding one mini chapter) each day as a good lockdown project. Note: I might call it "Everything is better in quarantine." The goal would be to (not) go mad.
I'm working on a text adventure that is simply hyperlinked HTML pages with some snippets of JS for state management (just a bunch of localstorage get/put) and fancy effects. It's refreshing to go back to using the "kiddie" tools to make things.