Inform

I learned about Inform (“a design system for interactive fiction based on natural language”) while I was looking at the Programming Puzzles & Code Golf StackExchange site.

Here is a very short Inform program that I wrote:

"Feed the Cat" by Joel Reyes Noche

When play begins, say "Put some tuna in the bowl to feed Mow."

The Dining Room is a room. "The kitchen is to the north."

Mow is an animal in the Dining Room. "Your cat Mow is rubbing against your legs." Understand "cat" as Mow.

The bowl is a container in the Dining Room.

The Kitchen is north of the Dining Room. "The dining room is to the south."

The refrigerator is a closed openable container that is fixed in place in the Kitchen. The tuna is in the refrigerator. The tuna is edible.

Instead of giving the tuna to Mow:

say "Mow stares at you and refuses to eat the tuna."

After inserting the tuna into the bowl:

say "You put the tuna in the bowl. Mow goes to the bowl and eats the tuna.";
remove the tuna from play;
end the game in victory.



Here’s a sample run of the program.

Put some tuna in the bowl to feed Mow.

Feed the Cat
An Interactive Fiction by Joel Reyes Noche
Release 1 / Serial number 140415 / Inform 7 build 6G60 (I6/v6.32 lib 6/12N) SD

Dining Room
The kitchen is to the north.

Your cat Mow is rubbing against your legs.

You can also see a bowl (empty) here.

>north

Kitchen
The dining room is to the south.

You can see a refrigerator (closed) here.

>open refrigerator
You open the refrigerator, revealing a tuna.

>get tuna
Taken.

>get refrigerator
That's fixed in place.

>examine refrigerator
The refrigerator is empty.

>close refrigerator
You close the refrigerator.

>south

Dining Room
The kitchen is to the north.

Your cat Mow is rubbing against your legs.

You can also see a bowl (empty) here.

>feed
(Mow the tuna)
Mow stares at you and refuses to eat the tuna.

>eat cat
(first taking Mow)
I don't suppose Mow would care for that.

>Mow, eat the tuna
(Mow first taking the tuna)
Mow has better things to do.

>put tuna in bowl
You put the tuna in the bowl. Mow goes to the bowl and eats the tuna.

*** You have won ***

Inform is very sophisticated but what I really like about it is its use of natural language.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s