Am I really the only person who doesn't get I7

Oh, wow! I have had so many wonderful answers. It is really nice to be on a forum where NuBees don’t get flamed for asking their brain-dead questions. The responses are all well considered. I am sure I can’t get everything into a single reply. I am just going to pick something to get started. In no particular order, here we go.

I believe you are taking your life into your own hands when you try to work in another person’s Perl code. :open_mouth: This problem is generally addressed by programming style. Even though the language imposes no limits, programmers will. That fits neatly into the easy things should be easy idea. If you write code for a living, you can count on some unknown programmer in the unspecified future making modifications to your work. Since there are big bucks on the line, the simpler and more straight forward your code the better.

Perl is as much a creature of its era as it is a powerful tool. I think the first pieces were done around about 85 or so. At the time we were still looking for the single language that could do everything. What we seemed to have settled on is task-specific languages. Like any craftsman, our tool box contains more than a single tool. It has several hammers for things that respond well to whacking. Several cutting implements that let us shear or shave. The same is true for the programmer. If we need to define persistent data stores, we use a data definition language (DDL) that is specific to the capabilities of the store. We pick other languages for other problems. I love spreadsheets, but they have a specific niche.

At its fundamental level a program transforms an input string (which may be persistent) into an output string (which may be persistent). The set of input and output strings needs to be closed. The program defines a closed and hopefully small set of transformations. In effect every program is an artificial grammar. I guess that’s why provability versus testability is a hot topic

I am sorry. I can’t find the constructs of story telling in traditional programming languages. I did take a look at TADS. What I saw was programming structures getting in the way of story telling structures. When I looked at I7 I didn’t see that problem.

The link to the comparison between the two languages was perfect for me. I don’t know either language well enough to make the points the author did. I came away with my basic reaction intact. I learned a bunch besides.

I took quick look at the if thread. Its going to take me a while to catch up to where you are. So let me address the responses in this thread before I get started on the other one.

Hmm, okay. When you said

…and tied that in with syntax-level comments about Inform, I think many of us (myself included) understood that as a preference for an OO language, of which there are already several.

But now it seems like you’re asking for something else entirely. So I’m curious: in your ideal language, what would you primarily spend your time defining, and how would you express it?

Good one! :laughing: It brings up an important point about I7 though: One of my very first reactions upon seeing some I7 code was that it was really easily readable. Deceptively so, in fact, because it’s not obvious in many cases that a particular phrasing will work when a similar-looking one will not. But after you get it right, those that come after can tell what you’re trying to do much more quickly than they would in most other languages.

It has taken me a while to put together the examples that show why there are problems with the If. I going to spread them accross several posts.

Here goes the first example. This is a working nested if. It uses colons and no tabs to manage the nesting. It translates correctly and executes correctly. Just like you said it would.

The Fruzzle is an animal.

The description of the Fruzzle is "An animal about the size of a big cat. It is covered in soft lavender fur. It has a long pointed muzzle. The dark band of fur across it’s eyes makes it look like it is wearing a mask. It’s long furry tail is covered in pumpkin colored splotches. "

The Fruzzle has a number called fear.
The fear of the Fruzzle is 0.
The large nut is a thing. “A heavy brown nut about the size of a couple of golf balls”

The forest is a room.

The Fruzzle is in the Forest.

Every Turn when the player is in the Forest:
say “fear is [the fear of the Fruzzle].”;
Increment fear of the Fruzzle;
If the fear of the Fruzzle > 6:
Say “The Fruzzle shreiks at you as it throws a large nut at you. It has remarkably good aim. The bruise should fade in a few days.”;
Now the large nut is in the forest;
else If the fear of the Fruzzle > 5:
Say “The Fruzzle has become quite agitated. It stands on it’s back legs, with it’s fur on end. It is now hissing and showing it’s formidable fangs.”;
else If the fear of the Fruzzle > 3:
Say “The Fruzzle begins to sway from side to side. It makes a funny noise that sounds like a warning.”;
else:
Say “The Fruzzle sits quietly. It seems to be curious about you.”;
Say “Somehow you find that vaguely uncomfortable.”

Here goes the second example. I took the working nested if and replaced the colons with commas. This made it syntactically incorrect. I got error messages. The second error message states that I can use the colon but I must use tab indentation.

So the reason I believe you have to have tabs with colons is the error message says so.

The Fruzzle is an animal.

The description of the Fruzzle is "An animal about the size of a big cat. It is covered in soft lavender fur. It has a long pointed muzzle. The dark band of fur across it’s eyes makes it look like it is wearing a mask. It’s long furry tail is covered in pumpkin colored splotches. "

The Fruzzle has a number called fear.
The fear of the Fruzzle is 0.
The large nut is a thing. “A heavy brown nut about the size of a couple of golf balls”

The forest is a room.

The Fruzzle is in the Forest.

Every Turn when the player is in the Forest:
say “fear is [the fear of the Fruzzle].”;
Increment fear of the Fruzzle;
If the fear of the Fruzzle > 6,
Say “The Fruzzle shreiks at you as it throws a large nut at you. It has remarkably good aim. The bruise should fade in a few days.”;
Now the large nut is in the forest;
else If the fear of the Fruzzle > 5,
Say “The Fruzzle has become quite agitated. It stands on it’s back legs, with it’s fur on end. It is now hissing and showing it’s formidable fangs.”;
else If the fear of the Fruzzle > 3,
Say “The Fruzzle begins to sway from side to side. It makes a funny noise that sounds like a warning.”;
else:
Say “The Fruzzle sits quietly. It seems to be curious about you.”;
Say “Somehow you find that vaguely uncomfortable.”

Translating the Source

This is the report produced by Inform 7 (build 6E72) on its most recent run through:
Problem. The rule or phrase definition ‘Every Turn when the player is in the Forest’ seems to use both ways of grouping phrases together into ‘if’, ‘repeat’ and ‘while’ blocks at once. Inform allows two alternative forms, but they cannot be mixed in the same definition.
One way is to end the ‘if’, ‘repeat’ or ‘while’ phrases with a ‘begin’, and then to match that with an ‘end if’ or similar. (‘Otherwise’ or ‘otherwise if’ clauses are phrases like any other, and end with semicolons in this case.) You use this begin/end form here, for instance - ‘else If the fear of the Fruzzle > 5, Say “The Fruzzle has become quite agita […] and showing it’s formidable fangs.”’ .
The other way is to end with a colon ‘:’ and then indent the subsequent phrases underneath, using tabs. (Note that any ‘otherwise’ or ‘otherwise if’ clauses also have to end with colons in this case.) You use this indented form here - ‘else’ .

Here is the third example. In this example I delimited blocks using colon. For if’s that are usually understood as not having a block, I used a comma. What I get is an error message about mixing begin and colon notation. I am not too sure that is error message is particularly helpful.

The Fruzzle is an animal.

The description of the Fruzzle is "An animal about the size of a big cat. It is covered in soft lavender fur. It has a long pointed muzzle. The dark band of fur across it’s eyes makes it look like it is wearing a mask. It’s long furry tail is covered in pumpkin colored splotches. "

The Fruzzle has a number called fear.
The fear of the Fruzzle is 0.
The large nut is a thing. “A heavy brown nut about the size of a couple of golf balls”

The forest is a room.

The Fruzzle is in the Forest.

Every Turn when the player is in the Forest:
say “fear is [the fear of the Fruzzle].”;
Increment fear of the Fruzzle;
If the fear of the Fruzzle > 6:
Say “The Fruzzle shreiks at you as it throws a large nut at you. It has remarkably good aim. The bruise should fade in a few days.”;
Now the large nut is in the forest;
else If the fear of the Fruzzle > 5,
Say “The Fruzzle has become quite agitated. It stands on it’s back legs, with it’s fur on end. It is now hissing and showing it’s formidable fangs.”;
else If the fear of the Fruzzle > 3,
Say “The Fruzzle begins to sway from side to side. It makes a funny noise that sounds like a warning.”;
else:
Say “The Fruzzle sits quietly. It seems to be curious about you.”;
Say “Somehow you find that vaguely uncomfortable.”

Translating the Source

This is the report produced by Inform 7 (build 6E72) on its most recent run through:
Problem. The rule or phrase definition ‘Every Turn when the player is in the Forest’ seems to use both ways of grouping phrases together into ‘if’, ‘repeat’ and ‘while’ blocks at once. Inform allows two alternative forms, but they cannot be mixed in the same definition.
One way is to end the ‘if’, ‘repeat’ or ‘while’ phrases with a ‘begin’, and then to match that with an ‘end if’ or similar. (‘Otherwise’ or ‘otherwise if’ clauses are phrases like any other, and end with semicolons in this case.) You use this begin/end form here, for instance - ‘else If the fear of the Fruzzle > 5, Say “The Fruzzle has become quite agita […] and showing it’s formidable fangs.”’ .
The other way is to end with a colon ‘:’ and then indent the subsequent phrases underneath, using tabs. (Note that any ‘otherwise’ or ‘otherwise if’ clauses also have to end with colons in this case.) You use this indented form here - ‘If the fear of the Fruzzle > 6’ .

Here is the fourth example. In this one I use begin notation for the blocks. I still use commas for ifs that are normally not understood as having blocks. This time the error messages are consistent. They now let us know that if you use block notion anywhere in an if structure you must use it everywhere. I think this is the first time the rule is ever spelled out.

The Fruzzle is an animal.

The description of the Fruzzle is "An animal about the size of a big cat. It is covered in soft lavender fur. It has a long pointed muzzle. The dark band of fur across it’s eyes makes it look like it is wearing a mask. It’s long furry tail is covered in pumpkin colored splotches. "

The Fruzzle has a number called fear.
The fear of the Fruzzle is 0.
The large nut is a thing. “A heavy brown nut about the size of a couple of golf balls”

The forest is a room.

The Fruzzle is in the Forest.

Every Turn when the player is in the Forest:
say “fear is [the fear of the Fruzzle].”;
Increment fear of the Fruzzle;
If the fear of the Fruzzle > 6 begin;
Say “The Fruzzle shreiks at you as it throws a large nut at you. It has remarkably good aim. The bruise should fade in a few days.”;
Now the large nut is in the forest;
else If the fear of the Fruzzle > 5,
Say “The Fruzzle has become quite agitated. It stands on it’s back legs, with it’s fur on end. It is now hissing and showing it’s formidable fangs.”;
else If the fear of the Fruzzle > 3,
Say “The Fruzzle begins to sway from side to side. It makes a funny noise that sounds like a warning.”;
else begin;
Say “The Fruzzle sits quietly. It seems to be curious about you.”;
Say “Somehow you find that vaguely uncomfortable.”

Translating the Source
This is the report produced by Inform 7 (build 6E72) on its most recent run through:
Problem. You wrote ‘else If the fear of the Fruzzle > 5, Say “The Fruzzle has become quite agita […] and showing it’s formidable fangs.”’ : but an ‘otherwise if’ (or ‘else if’) which uses a comma to give a single consequence can only be used immediately following an equally simple ‘if’, and can’t be used in the middle of a begin … end if block.
To provide alternatives within such a block, use ‘otherwise if … condition…;’ (in the same way that one would use ‘otherwise;’ without a condition).
See the manual: 11.8 > Otherwise
Problem. You wrote ‘else If the fear of the Fruzzle > 3, Say “The Fruzzle begins to sway from si […] noise that sounds like a warning.”’ : again, an ‘otherwise if’ (or ‘else if’) which uses a comma to give a single consequence can only be used immediately following an equally simple ‘if’.
Problem. You wrote ‘else begin’ : but inside an ‘if … begin’/‘end if’ an ‘otherwise’ (or ‘else’) must be a single word phrase, so it appears that the two ways to use ‘otherwise’ have been mixed up. It can either be used as ‘if … begin; …; otherwise; …; end if’, or as ‘if …, …; otherwise …;’.
Problem. You wrote ‘If the fear of the Fruzzle > 6 begin’ : but the definition of the phrase ended with no matching ‘end’ for this ‘begin’, bearing in mind that every begin must have a matching end, and that the one most recently begun must be the one first to end. For instance, ‘if … begin’ must have a matching ‘end if’.
See the manual: 11.7 > Begin and end

Here is the last example. I replace all of the colons with begin; I would expect that I should get a clean translation and execution like I did with colon notation. I don’t. Now I get errors telling me that begin; is inappropriate.

To me this says that a legitimate block structure suddenly become inappropriate simply by changing the symbol used as a block delimiter. That just doesn’t make any sense to me. Trying to sort out this syntax error from the error messages, just stumps me.

The Fruzzle is an animal.

The description of the Fruzzle is "An animal about the size of a big cat. It is covered in soft lavender fur. It has a long pointed muzzle. The dark band of fur across it’s eyes makes it look like it is wearing a mask. It’s long furry tail is covered in pumpkin colored splotches. "

The Fruzzle has a number called fear.
The fear of the Fruzzle is 0.
The large nut is a thing. “A heavy brown nut about the size of a couple of golf balls”

The forest is a room.

The Fruzzle is in the Forest.

Every Turn when the player is in the Forest:
say “fear is [the fear of the Fruzzle].”;
Increment fear of the Fruzzle;
If the fear of the Fruzzle > 6 begin;
Say “The Fruzzle shreiks at you as it throws a large nut at you. It has remarkably good aim. The bruise should fade in a few days.”;
Now the large nut is in the forest;
else If the fear of the Fruzzle > 5 begin;
Say “The Fruzzle has become quite agitated. It stands on it’s back legs, with it’s fur on end. It is now hissing and showing it’s formidable fangs.”;
else If the fear of the Fruzzle > 3 begin;
Say “The Fruzzle begins to sway from side to side. It makes a funny noise that sounds like a warning.”;
else begin;
Say “The Fruzzle sits quietly. It seems to be curious about you.”;
Say “Somehow you find that vaguely uncomfortable.”

Translating the Source
This is the report produced by Inform 7 (build 6E72) on its most recent run through:
Problem. You wrote ‘else If the fear of the Fruzzle > 5 begin’ : but an ‘otherwise if’ (or ‘else if’) should not take a ‘begin’, but acts as a divider within a begin/end block all by itself.
See the manual: 11.8 > Otherwise
Problem. You wrote ‘else If the fear of the Fruzzle > 3 begin’ : again, an ‘otherwise if’ (or ‘else if’) should not take a ‘begin’.
Problem. You wrote ‘else begin’ : but inside an ‘if … begin’/‘end if’ an ‘otherwise’ (or ‘else’) must be a single word phrase, so it appears that the two ways to use ‘otherwise’ have been mixed up. It can either be used as ‘if … begin; …; otherwise; …; end if’, or as ‘if …, …; otherwise …;’.
Problem. You wrote ‘If the fear of the Fruzzle > 6 begin’ : but the definition of the phrase ended with no matching ‘end’ for this ‘begin’, bearing in mind that every begin must have a matching end, and that the one most recently begun must be the one first to end. For instance, ‘if … begin’ must have a matching ‘end if’.
See the manual: 11.7 > Begin and end

I love i7. I think there are still a few stuffs to straighten but it’s a good metalanguage.
IMO the i6 level is what is wrong with I7, because of the structural limitation (no floating numbers, ridiculously awkward arrays, etc…).
For example, i developed an extension that is able to construct and initialize objects from indexed texts (a kind of small syntactic parser, build with a metalanguage, I7, manipulating a language that is interpreted/compiled for a virtual machine; I6. yep). It takes me around 1 sec to build one of those objects (because of the 7 or so regular expressions it uses). I also tried to implement an ascii animation reader. I cadenced it at 10 fps, but unfortunately it takes glux more than one second to read a 100*100 characters long frame. Meanwhile in the same time i can generate a 5000 pages long pdf with java.

So why not adapt i7 for java ? Why stick to a to a technology that date from the 70s ? I read somewhere the reason was that it “theoretically” enables zmachine games to be played on old nokia phones or something. But what kind of people use these devices ? Everyone has a smartphone nowadays !
Seriously, replace i6 with java. I tend to think that i6 now limits i7. Interactive fictions haven’t really change since the first ones were created. But what if someone wants to implement a semantic engine or a syntactic parser based on generative grammar ? You’ll probably need an efficient I/O system as well as various and robust memory structures. How are you supposed to do that when the functions you write must handle the way information is stored in memory ?

I am not sure if I am derailing or re-railing this thread by posting this, but here goes.

In response to: “Am I really the only person who doesn’t get I7”

No. I don’t get it, either. While I would never call myself a programmer, I do a lot of scripting at work and have written several small-to-medium sized VB apps. I am familiar with code, and I am familiar with content, and the way I feel right now at the moment is, the two should remain separate. I’ll admit that the majority of what I’ve seen of I7 code has come from this forum, but … and this is kind of hard to explain, but it makes more sense to me to write “if x = y then score = score + 1” than to write it out in natural English. I’d be curious to know if any other people with programming experience feel the same way. Or perhaps it’s just me. Or perhaps I haven’t given I7 a fair shake yet.

It seems to me that troubleshooting something in I7 would be much more difficult than I6.

I’ll give you an example. I’m the type of guy who prefers over . I know what will do every time, whereas may/could do different things in different browsers.

Re the fourth Fruzzle example:

Your code can be made to compile (correctly) by removing three "begin"s, and adding an “end if”.

Every Turn when the player is in the Forest:
say "fear is [the fear of the Fruzzle].";
Increment fear of the Fruzzle;
If the fear of the Fruzzle > 6 begin;
Say "The Fruzzle shreiks at you as it throws a large nut at you. It has remarkably good aim. The bruise should fade in a few days.";
Now the large nut is in the forest;
else If the fear of the Fruzzle > 5;
Say "The Fruzzle has become quite agitated. It stands on it's back legs, with it's fur on end. It is now hissing and showing it's formidable fangs.";
else If the fear of the Fruzzle > 3;
Say "The Fruzzle begins to sway from side to side. It makes a funny noise that sounds like a warning.";
else;
Say "The Fruzzle sits quietly. It seems to be curious about you.";
Say "Somehow you find that vaguely uncomfortable.";
end if;

I more or less followed the error messages here. The first two say “this thing does not take a ‘begin’”, so I removed “begin” and that was the correct action. The third is more obscure, but removing “begin” was still the right thing to do. The fourth error message says there’s no “end” for the “if…begin”.

I don’t know if that’s the code you want to write, but it’s the translation of your example into begin/end syntax.

I feel the same way. I’ve dabbled in Inform 7 over the last couple years and never gotten very far with it. Perhaps it’s necessary to overcome the mental bias toward regarding it as natural language, instead of an extremely verbose programming language. I found Ron’s document useful in that regard, as it spelled out equivalences between more traditional syntax structures.

But I’m not that interested in what’s left over once the natural language veil is lifted. Debugging seems to become exponentially harder past a certain amount of source text, owing to a variety of factors - lack of encapsulation, preponderance of global variables, one file limitation. The available extensions are nice but official support has been erratic in the past.

TADS is cool. It has its faults but I find I prefer them to Inform’s. Its infrastructure is lacking - no web interpreters, no cross-platform IDE - but that situation won’t ever change if people stop making TADS games. Right now I am happy writing out the content in transcript form and doing the implementation in a more familiar way. Mixing the two has a certain novelty value but the fun factor is lost on me.

I don’t know that I “get” I7, but you get accustomed to it, sort of like living with a cat. You may never fully understand why the cat feels the need to run growling through the apartment, hair on end, claws out, just at the moment there’s a jump scare on Amnesia, but after awhile, you sort of get accustomed to its moods and you both can coexist in mutual respect.

But not everyone is a cat person, so it’s worth shopping around. (I looked at TADS 3, and edged slowly away. It’s not the syntax or rules so much as the Cliffs-of-Despair-like learning curve. I just don’t want to spend that kind of time up front. I tend to work in manic bursts, and that kind of programming is hard to do that with unless I have pretty solid knowledge of the language involved - otherwise, I spend most of my energy playing catch-up. Still, if I get to a point in my life where I have a stable creative drive, I might give it another go.)

That’s quite possibly one of the best analogies I’ve ever heard in my life!

A popular quote, not sure by whom, goes like:

When someone says “I want a programming language in which I need only say what I wish done,” give him a lollipop.

The cat anaolgy is priceless :laughing: . Somebody has to make sure that gets into the documentation.

Fabulously funny!!

I was afraid that using “object” could cause some confusion. I am glad you brought it up. In later posts I tried to use the word “construct” instead.

As I have been saying from the beginning, I am just getting started with I7. So some of the things I want may already be provided by I7. I have not yet learned them. In one of the earlier posts the point was made that perhaps the problem lay in the documentation and error messages rather than the language. I think that is a good point. While it is fair to ask me what I think the perfect language is, it is none-the-less a daunting task. So I am going to try to back into it. I am sure it won’t be pretty.

For most of us, the basic interaction between us and computers is turn based. This is true in IF. The person does something like entering a command. The computer attempts to follow the command and posts a reply. It is equally valid to see the computer as entering commands which the person obeys and then posts a reply. These two views could be combined into one. We see this as two worlds with a common message port. There is an agreement by which the worlds politely wait their turn to post something onto the message port.

It works out that people try to organize their understanding of the computer side of the interaction. This understanding goes beyond simply memorizing commands. They create a mental model (sometimes called a metaphor) which becomes predictive or proscriptive. This lets the person effectively guess what they should do in a novel situation. Also, it is a handy way for the person to organize what they know. Consequently, it lets the person effectively anticipate the computer’s behavior.

Let me give you an example. In the early days of word processing the product developers were looking to make it easy for people to switch from typewriters. They went to clerk typists and asked them how they wanted things to work. Not surprisingly, they wanted the computer to mimic a typewriter. Thus was born Word Perfect. As more of us began to use word processing, it became clear we all had flunked Typing I. This created an opening in the market. Now developers asked the rest of us how word processing should work. They got an entirely different mental model or metaphor. This gave rise to Microsoft Word. Eventually, the typewriter dummies like me carried the day.

So part of the answer to what is a perfect IF language lies in understanding which mental models or metaphors to use.

My perfect language part 2

It appears to me that IF stories follow some common approaches. They might be called genera. The first is the puzzle genera. In these stories the person must solve all of the puzzles to “win”. The second is the discovery genera. In these stories the person must visit every place in the world to “win”. The third is the DND genera. In these stories the person is represented by an avatar. The avatar, like all characters in the story, has innate properties. These include things like strength, knowledge, speed, and so on. In these stories the person must put the avatar through various trials to increase properties like strength or knowledge. As the avatar becomes “stronger” the game becomes richer by introducing ever more challenging implements, characters and locations. The player “wins” by growing the avatar to its maximum capacity, thereby revealing all of the world and its challenges.

When I look at all of these genera I see a commonality. To me, they are essentially board games, with the computer becoming the other players, game board, score keeper, arbiter and dice. Thus my mental model or metaphor is the board game.

Broadly speaking I can create two families of board games. First are games in which the player functions like the shoe in a Monopoly game. It is simply a token representing the player’s position in the world. The player’s capabilities are reflected only in the person’s knowledge of the game. The second are games in which the player functions as an avatar. The player’s position and capabilities are reflected in the game world through the avatar. The person’s knowledge is moderated by the avatar’s capabilities.

In my imagination creating players works something like this. There is an individual known as the player character (PC). He is built on the basic construct called Player. Player is built directly on a construct called Token. Token deals with very simple things like keeping track of the current location. This lets me create a PC who functions like the shoe in Monopoly.

I could also create an avatar based PC. He is built on the basic construct Player. Player is now built on the construct Avatar, which in turn is built on Token. Avatar deals with things like strength, wisdom and health. This lets me create a PC who functions through the capabilities of his avatar.

I imagine that a Non-player character (NPC) is built similarly. NPC is built on Player. Some NPC’s need to grow and change, so they would be built on Avatar, which is built on Token. Some NPC’s don’t need to grow, so they are built on Player, which is built on Token.

NPC,s need to add another construct that corresponds to capabilities the person brings to the game. I think of this construct as Personality. (I understand I7 to have some of these capabilities now. For example generating NPC responses based on who is in the room.) Personality is built on the construct AI. AI should be understood broadly as artificial intelligence. For example, this gives an NPC the ability to engage in goal seeking behavior.

The final piece of the NPC is Individual. It is built on Player. It lets us build two dwarfs with different names, physical descriptions, and personalities. Yet they both act like dwarfs are supposed to.

I realize the language I have chosen sounds like objects and inheritance. I am not suggesting any particular kind of implementation. What I am suggesting is a mental model and a conceptual way to understand its workings.

wfryers: In what way do you visualize the author telling the computer about the differences between this particular game’s [PC/NPC/environment] and the default options?