A Tale of Two Languages

 in
Inform version 6 and version 7 are about as different as two languages can be, so your choice of which one to use for your next great game boils down to personal preference.

The differences between the two languages are apparent from the first lines. When starting a story in Inform 6, there are some essential housekeeping duties that need to be done at the beginning (i6:001-007) and end (i6:172-193) in order for the story to compile (Listing 2).

In Inform 7, the only thing that is absolutely required is the first line (i7:001). To be fair, the initialization routine in Inform 6 also includes the message that is displayed at the beginning of the game. In Inform 7 this also is there (i7:007-011), but it's not required for successful compilation (Listing 3).

The defining of variables is similar in both versions—for instance, the maximum score variable (i6:009, i7:005). The main difference is that the Inform 6 version uses C-like syntax:

Constant MAX_SCORE = 6;

And, Inform 7 uses a sentence that reads similarly to how one would read the Inform 6 version out loud:

The maximum score is 6.

Some of the differences between versions are similarly minor. One example is the method of inserting paragraph breaks into long sections of text, such as in the description of the Server Room (i6:114-118, i7:082-086, Listing 4). In Inform 6, two carat symbols (^^) are used, and in Inform 7, the statement paragraph break enclosed in square brackets ([]) does the job.

One big mistake I made when I started was creating everything first in Inform 7, and then creating the equivalent Inform 6 code. This proved tricky on a couple occasions—most notably with the random beeping messages that appear at every turn while you are in the server room (until you fix the server and win the game). Programming such logic is very different in each version. In Inform 7, writing this took almost no thought at all (i7:097-103). Basically, I described what I wanted to happen every turn, and Inform 7 made it happen. The Inform 6 code to do the same thing is not as advanced (i6:120-134). It's basically a case statement, but it's significantly more difficult to write in comparison (Listing 5).

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

The Link to the files

Anonymous's picture

The link in the magazine was incorrect. The files are actually located here:

ftp://ftp.linuxjournal.com/pub/lj/listings/issue174/10130.tgz

One other thing to keep in mind: if you want to compile the code, first remove the line numbering.

Looking for code...

augmentedfourth's picture

I'm also curious where the code is!

The Link was incorrect

Webmistress's picture

But is fixed now.

Katherine Druckman is webmistress at LinuxJournal.com. You might find her on Twitter or at the Southwest Drupal Summit

Ah... I had been trying to

augmentedfourth's picture

Ah... I had been trying to get the code from the link within the article, not the link at the end. The link in the article should be updated as well.

Unavailability of sources issue 174

Anonymous's picture

I know Linux Journal has been getting worse lately but this is the first time that the sources for an issue are entirely unavailable. The credit crash hitting linux journal already?

Webcast
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers

Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.

Learn More

Sponsored by AMD

White Paper
Red Hat White Paper: Using an Open Source Framework to Catch the Bad Guy

Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6

Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.

Learn more about catching the bad guy in this free white paper.

Learn More

Sponsored by DLT Solutions