ChatGPT generated this Inform 7 (and attempted 6) code

I saw a post that used GPT to simulate a text adventure, but I wanted to see if the latest incarnations could do something more portable. I went into ChatGPT and asked it to “Write code that describes a jungle forest in the language Inform 7”

It’s simplisitic, but it did generate this (I won’t lie; I felt a little shocked)

The Jungle Forest is a room.

The description of the Jungle Forest is "You are standing in a dense jungle forest. The air is hot and humid, and the sounds of exotic birds and animals fill the air. Tall trees with thick foliage tower overhead, blocking out much of the sunlight. A tangled mass of vines and undergrowth covers the ground, making it difficult to navigate."

The Trees are scenery in the Jungle Forest. The description of the Trees is "The trees in the jungle forest are incredibly tall and covered in thick foliage. Some of them have vines and other plants growing on them, adding to the dense, tangled appearance of the forest."

The Vines are scenery in the Jungle Forest. The description of the Vines is "The vines in the jungle forest are thick and tangled, making it difficult to move through the undergrowth. They are covered in a variety of exotic plants, including brightly colored flowers and strange-looking fruits."

The Undergrowth is scenery in the Jungle Forest. The description of the Undergrowth is "The undergrowth in the jungle forest is dense and tangled, making it difficult to move through the forest. It is a mix of ferns, shrubs, and other plants, all competing for space in the dense jungle environment."

The Birds are scenery in the Jungle Forest. The description of the Birds is "The birds in the jungle forest are exotic and brightly colored. They can be heard singing and calling to each other from the tops of the tall trees. Some of them are quite large, with long, elegant tail feathers."

The Animals are scenery in the Jungle Forest. The description of the Animals is "The animals in the jungle forest are a mix of familiar and exotic species. Some of them can be seen moving through the undergrowth, while others are more elusive and can only be heard calling to each other from the dense foliage."

The player is in the Jungle Forest.

Inform 7 seemed to balk at “The Animals” part, but taking that out it worked just fine.
The Inform 6 result was mostly I6 but then it slipped into I7 syntax a bit at the end.

Include "Parser";
Include "VerbLib";

Object Jungle "Jungle Forest"
  with description "You are standing in a dense jungle forest. The air is hot and humid, and the sounds of exotic birds and animals fill the air. Tall trees with thick foliage tower overhead, blocking out much of the sunlight. A tangled mass of vines and undergrowth covers the ground, making it difficult to navigate."
  has scenery;

Object Trees "trees"
  with description "The trees in the jungle forest are incredibly tall and covered in thick foliage. Some of them have vines and other plants growing on them, adding to the dense, tangled appearance of the forest."
  has scenery;

Object Vines "vines"
  with description "The vines in the jungle forest are thick and tangled, making it difficult to move through the undergrowth. They are covered in a variety of exotic plants, including brightly colored flowers and strange-looking fruits."
  has scenery;

Object Undergrowth "undergrowth"
  with description "The undergrowth in the jungle forest is dense and tangled, making it difficult to move through the forest. It is a mix of ferns, shrubs, and other plants, all competing for space in the dense jungle environment."
  has scenery;

Object Birds "birds"
  with description "The birds in the jungle forest are exotic and brightly colored. They can be heard singing and calling to each other from the tops of the tall trees. Some of them are quite large, with long, elegant tail feathers."
  has scenery;

Object Animals "animals"
  with description "The animals in the jungle forest are a mix of familiar and exotic species. Some of them can be seen moving through the undergrowth, while others are more elusive and can only be heard calling to each other from the dense foliage."
  has scenery;

[Initial location]
Jungle is the initial location.

[Exits]
Jungle is a room.

[Verbs]

5 Likes

Not bad! It could use some synonyms and some custom actions with regards to the scenery objects, but could be useful for generating some baseline code.

I’m wondering how well it does with debugging, as has been demonstrated for other languages. Since its first attempt didn’t take into account that animal is a built-in kind, I would guess not that well. It would be fun to see it try, though. You could even just give it its own jungle scene source code and describe the resulting problem message.

Didn’t Emily Short do an experiment with trying to have it complete a room description of a Victorian living room based on an initial prompt of a few objects? (I can’t recall where I saw it – maybe a Narrascope presentation?) EDIT: Nope, it was “an American living room circa 1977,” shown as part of a talk by Graham Nelson – see Narrascope 2022 talk | Inform 7. The relevant section is near the end.

2 Likes

Write a bubble sort in Inform 7:

To decide what is the biggest of (A, B):
   if A > B:
      decide on A
   otherwise:
      decide on B

To sort (A - a list of numbers):
   let N be the number of entries in A;
   repeat with I running from 1 to N-1:
      repeat with J running from 1 to N-1:
         if the biggest of (A entry J, A entry J+1) is A entry J+1:
            now A entry J is A entry J+1;
            now A entry J+1 is A entry J.

Almost correct. I like that it can write a decide rule.

Trying to get it to spit out code based on TV shows and movies. Mostly unusable code, just descriptions of plot events written in the style of Inform 7. But one movie with a MacGuffin the characters are searching for had that object given the concealed property by ChatGPT which showed a pretty smart correlation between plot and code, I thought.

Yes, for textual descriptions of things it does a pretty darn good job. The code scaffolding that builds the game proper definitely feels a long way off (although GPT4 is apparently imminent, so I’ll probably eat those words in 6 months).

@mathbrush
It could be interesting to have it generate various “start rooms” as inspiration for a setting, or even a full game.

1 Like