Site Map
:: Bitwise Courses ::
Bitwise Dusty Archives



ruby in steel

learn aikido in north devon

Learn Aikido in North Devon


Section :: Rants and Raves

- Format For Printing...

Programming in English

More than just a game
Tuesday 20 November 2012.

One day, the kind of programming we do now will no doubt seem crude in the extreme. All those ifs and fors, procedure-calls and whatnot surely can’t be the simplest and most elegant way for a human being to express ideas to a machine.

So why don’t we program computers in, well, English?

The obvious answer to this question is: because it’s too difficult. English is complex and ambiguous. Most of the time when we write computer programs we aim for simplicity and clarity. Even so, being able to convey ‘natural language’ instructions to a computer is a goal worth aiming for. Captain Kirk can do it so why can’t we?

One type of program that attempts to make sense of English commands is the good old text adventure. “Pick up the ring”, the player says. To which the game responds, “Do you mean the golden ring or the silver ring?”

It’s all very well that the game player can enter instructions in English. But the game programmer has to write instructions in Java or Ruby, C++ or Python. There are, of course, some languages such as TADS, which are specifically tailored to the writing of games. Even so, most of these are, at heart, traditional types of programming language with ifs, fors and procedure calls.

I was intrigued, therefore, to discover a game-writing language that breaks away from this coding tradition and gives the programmer a way of writing games using instructions that look very like English sentences. Inform 7 lets you create rooms by just writing the room name followed by the assertion “is a room” and its description. You can connect rooms together by entering statements such as “Room One is east of Room Two”. Objects and interactions can be described and expressed in a similar way. I really find this a fascinating approach, not only to writing games but to programming in general.

It’s also remarkably easy to get started. Here, in its entirely, is a game that I wrote in about 15 minutes. it’s not a big or complex game, to be sure, but even so, it is much, much more complex than any comparable game I could have written in that time using a conventional language:

The Gazebo is a room. "A lovely crystal gazebo in the garden".
The Dragon Lair is a room. "A big smelly cave".
The Crystal Dome is a room. "A huge glittering dome filled with exotic plants".
The Dragon Lair is south of the Gazebo.
The Crystal Dome is east of the Gazebo.

The wood-slatted crate is in the Gazebo. The crate is a container.
The ruby is in the crate.
The crate is closed.
The crate is openable.

The wombat is an animal. The wombat is male. The description of wombat is "It is a small, furry animal".
The wombat is in the Gazebo.

The description of the Elvish Sword is "A sword of purest gold that glows in the dark."
The Elvish Sword is in the Dragon Lair.

The description of the Dwarf Sword is "A sword of darkest Dwarf-iron."
The Dwarf Sword is in the Dragon Lair.

On the left you see the ‘program code’ of my game. On the right, I am playing the game.

Inform 7 comes with its own simple editing and compiling environment and it is available for Linux, Solaris, Windows and OS X. It’s a wonderfully eccentric project that is more innovative and ambitious in its aims than many better known general-purpose programming languages. I love it.

Inform 7 Download page: http://inform7.com/download

AddThis Social Bookmark Button



.05 ml synthroid http://www.redligare.org/spip.php?buy=403013 clomid fsh concentrated tylenol http://www.redligare.org/spip.php?buy=901169 coumadin monitoring http://www.redligare.org/spip.php?buy=905414 dizziness lipitor coumadin coq10 generic for zyprexa crestor recipes information verapamil amlodipine meniere's meclizine synthroid litigation in united states ashwagandha in new york over-the-counter allegra fosamax medical study baby tylenol period vincent allegra benadryl oral otc trental electives flexeril roono topamax dryness motrin advertisements info about lipitor substitute prilosec for ulcers reglan pump phimosis betnovate in mayami pcos clomid metformin in california celebrex indonesia lamictal antipsychotic generic claritin stress on coumadin more mobic verses celebrex http://www.redligare.org/spip.php?buy=368000 http://www.redligare.org/spip.php?buy=543463 http://www.redligare.org/spip.php?buy=213164 fosamax femur in california allegra apartments henderson more info about cephalexin oral suspension withdrawral from lexapro http://www.redligare.org/spip.php?buy=74036 more motrin nosebleeds male sex buspar biaxin generic more geodon tours evista art pro in mayami verapamil headaches coreg heart rash paxil melatonin for insomnia canada drug actonel chantix new orleans in mayami http://www.redligare.org/spip.php?buy=89217 cymbalta withdrawals diovan genetric http://www.redligare.org/spip.php?buy=278622