A Tale of Two Languages
Listing 1. Describing a CD Tray in Inform 7
094 The CD Tray is part of the old server. 095 The description is "It's a CD tray."
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).
Listing 2. Essential Code for Compiling Inform 6
001 !% -SD 002 003 !======================================================== 004 Constant Story "The Server Room"; 005 Constant Headline 006 "^An Interactive Fiction by Daniel Bartholomew.^"; 007 Release 1; Serial "080625"; !for keeping track of releases . . 172 !======================================================== 173 ! Entry point routines 174 175 [ Initialise; 176 location = break_room; 177 "^^^^It's Saturday, a nice one at that, and you've been 178 called to fix a server. Again.^^You've had it. This 179 server is going to run Linux starting today! The process 180 will be easy, just put the disc into the server go. 181 Now where is that Ubuntu CD?^"; 182 ]; 183 184 [ Deathmessage; 185 if (deadflag == 5) print "You have won"; 186 ]; 187 188 !======================================================== 189 ! Standard and Extended Grammar 190 191 Include "Grammar"; 192 193 !========================================================
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).
Listing 3. Initial Program Code for Inform 7
001 "The Server Room" by "Daniel Bartholomew" 002 003 Include GNU GPL v3 by Free Software Foundation. 004 005 The maximum score is 6. 006 007 When play begins, say "It's Saturday, a nice one at that, 008 and you've been called to fix a server. Again. 009 [paragraph break]You've had it. This server is going to 010 run Linux starting today! The process will be easy, just put 011 the disk in the server and go. Now where is that Ubuntu CD?"
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.
Listing 4. Syntax for Describing a Room
Inform 6 Version: 114 description "The fans, the lights, the chill... yep, it's a 115 server room. Full of servers from a dozen vendors, 116 each with their own quirks.^^Your attention is 117 immediately drawn to a server 2/3 of the way up rack 7. 118 The indicator light is blinking red and beeping.", Inform 7 Version: 082 The Server Room is a room. "The fans, the lights, the chill... 083 yep it's a server room. Full of servers from a dozen 084 vendors, each with their own quirks.[paragraph break]Your 085 attention is immediately drawn to a server 2/3 of the way up 086 rack 7. The indicator light is blinking red and beeping."
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).
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.
Sponsored by AMD
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.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- Reply to comment | Linux Journal
7 hours 24 min ago - Nice article, thanks for the
18 hours 5 min ago - I once had a better way I
23 hours 51 min ago - Not only you I too assumed
1 day 8 min ago - another very interesting
1 day 2 hours ago - Reply to comment | Linux Journal
1 day 3 hours ago - Reply to comment | Linux Journal
1 day 10 hours ago - Reply to comment | Linux Journal
1 day 11 hours ago - Favorite (and easily brute-forced) pw's
1 day 12 hours ago - Have you tried Boxen? It's a
1 day 18 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
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.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




Comments
The Link to the files
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...
I'm also curious where the code is!
The Link was incorrect
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
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
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?