ChatGPT-4 helps me design a new IF platform

I’ve been playing around with ChatGPT-4 after seeing Luke Bechtel’s article on using it to design a new programming language. The experiment will be to design a C# based IF platform using fluid syntax and a world model based on an in-memory data store.

It’s actually going okay so far, but I’m current time-blocked until tomorrow.

This is an earlier phase before clarifying more principles with GPT-4:

using IFPlatform.WorldModel;
using IFPlatform.WorldModel.Nodes;
using IFPlatform.WorldModel.Edges;
using IFPlatform.WorldModel.CloakOfDarkness;

class Program
{
    static void Main(string[] args)
    {
        // Initialize the World
        var world = new World();

        // Create Locations
        Foyer foyer = world.Create<Foyer>();
        Bar bar = world.Create<Bar>();
        Cloakroom cloakroom = world.Create<Cloakroom>();

        // Create Items
        DarkCloak cloak = world.Create<DarkCloak>();
        EmptyHook hookFoyer = world.Create<EmptyHook>();
        CloakHook hookCloakroom = world.Create<CloakHook>();

        // Add Relationships (Edges)
        world.Connect(foyer, bar, Direction.North);
        world.Connect(bar, foyer, Direction.South);
        world.Connect(bar, cloakroom, Direction.West);
        world.Connect(cloakroom, bar, Direction.East);

        world.AddTo(foyer, hookFoyer);
        world.AddTo(cloakroom, hookCloakroom);
        world.AddTo(cloakroom, cloak);

        // ... Initialize other components and start the game engine
    }
}

I’m just having a conversation with the AI to design and improve the code. It’ll be interesting to see where this goes and how long it takes to get Cloak of Darkness running.

I’ve already instructed GPT-4 to make everything mode fluid and strongly-typed and abstract the idea of Nodes and Edges away from the library author or the story author. It already knows there’s a parser with tokenized grammar, a grammar library that validates token lists with the world model, a game engine, and more.

It’s insane how much it can infer. The whole Cloak of Darkness thing was directed by this statement:

Code an example of building the world model for Cloak of Darkness.

To which it responded with:

Cloak of Darkness is a simple IF game that serves as an example for implementing an IF system. The game consists of three rooms: Foyer, Bar, and Cloakroom. There is a dark cloak in the Cloakroom, and the player needs to hang the cloak in the Bar to win the game.

Let's build the World Model for Cloak of Darkness using our defined classes.

and off it went. I did not have to describe Cloak of Darkness beyond that statement.

I’m mostly modeling the structure after Inform 6 to start, though I do plan to implement some alternate text emission scenarios. I’ll be able to save all of the instructions off and anyone could alter them to emit python or golang or TypeScript.

I have no estimate for completion because we’re currently limited to 25 queries in a 3-hour period, but I’d guess I’d have a workable Cloak of Darkness in a few days. A more robust platform in a few weeks and an extensible platform in a few months.

Light years faster than anything we’ve done in the past.

I also believe this changes the entire concept of Speed-IF. Given access to ChatGPT, a speed-if contest could allow an author to develop a much more detailed and working story in the alloted two hours. Almost zero coding and all story design.

I liken GPT-4 to the advent of the Internet, the PC, computers in general, the industrial revolution, and every major leap forward in human history.

5 Likes

Maybe a leap forward for machines?

3 Likes

(Excited, heavy breathing)

I’ve recently made an account for ChatGPT, because I feel like if this is going to change the world, then I might as well get good at it now.

It’s a weird experience, because the power is clearly there, but my brain is so stuck at “…I can’t decide what to use this for.”

2 Likes

Made some progress today, but the AI is struggling with the lines between parser, grammar, and standard library. I’ve been through a few iterations of this and still figuring out how to elicit the right balance from GPT-4. It’s getting close, but it’s not quite right.

And just so we’re clear. I’m trying to avoid “jumping in” and fixing the code. I’m trying to get the AI to do 98% of the coding.

One other challenge is how to organize the solution. I will have to back track and redo that since I don’t like the current structure. I let GPT infer a structure, but I think I need to be clear about that before generating code.

Here’s more code for your entertainment:

using IFPlatform.Grammar;

namespace IFPlatform.StandardLibrary
{
    public class StandardLibrary
    {
        private readonly Grammar _grammar;

        public StandardLibrary(Grammar grammar)
        {
            _grammar = grammar;
            DefineCommandStructures();
        }

        private void DefineCommandStructures()
        {
            _grammar.CreateCommand("take").WithPattern("verb noun");
            _grammar.CreateCommand("drop").WithPattern("verb noun");
            _grammar.CreateCommand("look").WithPattern("verb noun");
            // ... add other command structures

            // Complex command structures
            _grammar.CreateCommand("put")
                .WithPattern("verb noun on noun")
                .WithPattern("verb noun in noun");

            _grammar.CreateCommand("ask")
                .WithPattern("verb npc about topic");

            _grammar.CreateCommand("look up")
                .WithPattern("verb topic in noun");
            
            // ... add other complex command structures
        }
    }
}
3 Likes

I backtracked on my conversation with ChatGPT.

I think we need to backtrack on the overall design and discuss principles.

*** ChatGPT ***
Certainly! It’s important to have a clear understanding of the overall design principles and goals before diving into implementation details. Here are some key principles to consider when designing an interactive fiction (IF) platform:

Modularity: Design the platform in a way that allows different components (like the parser, grammar library, world model, and standard library) to work together seamlessly while being independent of one another. This makes it easier to maintain and extend the platform in the future.

Extensibility: Ensure that the platform can be easily extended with new features, custom libraries, and even alternative parser or world model implementations without requiring major changes to the core architecture.

Ease of use: Make it simple for authors to create interactive fiction stories with minimal boilerplate code and a clean, intuitive API. This includes providing a fluid syntax for defining the world model and command structures, as well as clear error messages and debugging tools.

Flexibility: Allow authors to define custom rules, commands, and behaviors that suit their specific story requirements. This might involve supporting complex command structures, conditional responses, or even procedural content generation.

Performance: Optimize the platform for fast execution and low memory overhead. This may involve implementing efficient data structures, caching, or other techniques to ensure that the platform can handle large, complex stories with many locations, objects, and interactions.

Portability: Design the platform to be easily adaptable to different platforms and environments, such as web browsers, mobile devices, or desktop applications.

Documentation and community: Provide comprehensive documentation, tutorials, and examples to help authors get started with the platform quickly. Encourage community involvement by making the platform open-source and fostering a supportive community of users and contributors.

These principles should help guide the design and development of your IF platform. They will ensure that your platform is both powerful and easy to use, making it a valuable tool for interactive fiction authors. With a solid foundation in place, you can then iterate on the platform’s features and capabilities to continually improve and expand its functionality.


Perfect. Regarding modularity, I would like to identify the core components and their responsibilities.

*** ChatGPT ***
Certainly! Here’s a breakdown of the core components of an interactive fiction
platform and their responsibilities:

  1. World Model: This component is responsible for maintaining the state of the story world, including locations, objects, characters, and relationships between them. It should provide a clean and fluid API for authors to define and interact with the world model, such as adding locations, setting up connections between locations, and adding items to locations.
  2. Parser: This component takes user input as plain text and tokenizes it into structured data. It is responsible for identifying verbs, nouns, and other elements of the user’s command. The parser should be flexible enough to handle a variety of input formats and recognize different synonyms or abbreviations for the same command.
  3. Grammar Library: This component is responsible for defining and validating command structures. It allows authors to define custom command patterns using a fluid syntax, such as “verb noun” or “verb adjective noun”. The grammar library should be able to work with the parser to validate user input against the defined command structures, ensuring that the input is both grammatically correct and contextually appropriate within the story world.
  4. Standard Library: This component provides a set of commonly used commands, objects, and behaviors for interactive fiction stories, such as “take”, “drop”, “examine”, and “go”. It leverages the grammar library to define the command structures for these standard commands and can also provide default implementations for their behavior. Authors should be able to easily extend or override the standard library to customize the behavior of their story.
  5. Game Engine: This component is responsible for managing the game loop and coordinating interactions between the other components. It processes user input, updates the world model based on the input and the current state of the story, and generates appropriate output to display to the user. The game engine should also handle saving and loading game state, as well as managing any timers or event-driven behavior within the story.

By clearly defining the responsibilities of each core component, you can ensure that your interactive fiction platform remains modular and easy to maintain. This separation of concerns will also make it simpler to extend the platform with new features or integrate it with other tools and libraries in the future.


Let's add one more component. We need a Text Service to accept emitted text
from the platform and organize it for output based on context and rules.

*** ChatGPT ***
Absolutely! A Text Service component can be a valuable addition to an interactive fiction platform. Here’s a brief overview of its responsibilities:

  1. Text Service: This component is responsible for managing and organizing text output generated by the platform, such as descriptions, messages, and responses to user commands. It should provide a consistent and customizable interface for formatting and displaying text, taking into account the context of the story and any rules or preferences defined by the author. Key responsibilities of the Text Service component include:
  • Text buffering: Collect and store text output generated during a single turn or interaction, allowing for later manipulation, formatting, or filtering before displaying it to the user.
  • Text formatting: Apply consistent formatting rules to the text output, such as capitalization, punctuation, and line breaks. This may also include support for text styling (e.g., bold, italic) or colorization, if desired.
  • Conditional output: Manage conditional text, allowing authors to define text that is only displayed under certain conditions or based on the current state of the story world. This can be useful for creating dynamic descriptions or responses that change based on the player’s actions or choices.
  • Output organization: Organize text output into logical sections or groups, such as room descriptions, object descriptions, character dialogue, and action responses. This can help improve the readability and flow of the text for the player.
  • Customization: Provide an easy way for authors to customize the Text Service’s behavior, such as defining their own formatting rules or output templates. This allows authors to create a unique look and feel for their story without having to modify the core platform code.

By incorporating a Text Service component into your interactive fiction platform, you can ensure that the text output is clean, consistent, and well-organized, enhancing the overall user experience and making it easier for authors to craft immersive and engaging stories.


2 Likes

And continuing…

Execution of all user input should be delegated to the Standard Library or overridden in the user's Story File.

*** ChatGPT ***
To achieve this, you can design the platform in such a way that the Game Engine delegates the execution of user commands to the Standard Library by default. The Standard Library should provide a set of standard command implementations, as well as a mechanism for authors to extend or override them in their Story Files.

Here’s a high-level approach to achieve this:

  1. Define command handlers: In the Standard Library, create command handler classes or methods for each standard command. These handlers will encapsulate the logic for executing the command and interacting with the World Model.
  2. Create a command registry: In the Standard Library, maintain a registry or dictionary that maps command patterns or verbs to their respective command handlers. This registry will be used by the Game Engine to look up and execute the appropriate handler for a given user input.
  3. Allow custom command handlers: Provide a way for authors to define their own command handlers in their Story Files. These custom handlers can either extend the functionality of a standard command or completely override its behavior.
  4. Register custom command handlers: When the author defines a custom command handler in their Story File, update the command registry in the Standard Library to map the corresponding command pattern or verb to the new handler. This will ensure that the custom handler is executed instead of the default handler when the command is invoked.
  5. Delegate command execution: In the Game Engine, when processing user input, look up the command handler for the given command pattern or verb in the Standard Library’s command registry. If a handler is found, delegate the execution of the command to that handler, passing any relevant context or arguments as needed.

By following this approach, you can ensure that the execution of user commands is delegated to the Standard Library by default, while also providing the flexibility for authors to customize or override command behavior in their Story Files as needed.


Of all of these components, which one should we dive deeper into to start?

*** ChatpGPT ***
Let’s start with the World Model component, as it serves as the foundation of the interactive fiction platform by representing the underlying story world, its objects, characters, and relationships. A well-designed World Model will make it easier to build the other components and ensure a smooth integration between them.

When building the World Model component, you’ll want to consider the following aspects:

  1. Data structures: Design the data structures that will represent the various elements in the story world, such as rooms, objects, characters, and connections between them. Consider using object-oriented concepts and design patterns, such as inheritance and composition, to make the structures flexible and extensible.
  2. Strongly-typed nodes and edges: Implement the nodes and edges in the in-memory graph as strongly-typed classes or structures. This will make it easier to work with the data and ensure that only valid relationships can be established between the elements in the story world.
  3. Fluid creation and modification: Provide a fluid API or domain-specific language for creating and modifying the elements in the World Model. This will allow authors to easily define their story world and interact with it during the development of their interactive fiction.
  4. Querying and traversal: Implement methods for querying and traversing the graph of nodes and edges in the World Model. This will enable other components, such as the Parser and Game Engine, to interact with the story world and determine valid actions or commands based on the current state.
  5. Serialization and deserialization: Implement mechanisms for saving and loading the state of the World Model to and from external storage, such as files or databases. This will allow authors to save their progress and resume their work on the story at a later time.

By focusing on the World Model component first, you’ll establish a strong foundation for the interactive fiction platform and gain a better understanding of how the other components will interact with and build upon the story world.


2 Likes

I’m on my third iteration as ChatGPT will get confused by the conversation.

I got through the basics for world model, standard library, game engine, story runner, and story. Then I went into grammar feel that’s very close.

I started on the parser and this is where ChatGPT struggles. There’s complex behavior between several components and it’s not good at that integration.

Grammar looks like it’s workable.

// Grammar.cs
public class Grammar
{
    private List<string> _components;

    public Grammar()
    {
        _components = new List<string>();
    }

    public Grammar Verb(string verb)
    {
        _components.Add($"VERB:{verb}");
        return this;
    }

    public Grammar Noun()
    {
        _components.Add("NOUN");
        return this;
    }

    public Grammar Adjective()
    {
        _components.Add("ADJECTIVE");
        return this;
    }

    public Grammar A => Article("a");

    public Grammar An => Article("an");

    public Grammar The => Article("the");

    private Grammar Article(string article)
    {
        _components.Add($"ARTICLE:{article}");
        return this;
    }

    public Grammar In => Preposition("in");

    public Grammar On => Preposition("on");

    // Add more prepositions as needed...

    private Grammar Preposition(string preposition)
    {
        _components.Add($"PREPOSITION:{preposition}");
        return this;
    }

    public string End => string.Join(" ", _components);
}

Allows for:

Grammar grammar = new Grammar();
string action1 = grammar.Verb("TAKE").Noun.End;
string action2 = grammar.Verb("EXAMINE").Adjective.Noun.End;
string action3 = grammar.Verb("OPEN").The.Noun.End;
string action4 = grammar.Verb("PUT").Noun.On.Noun.End;

To be continued…

1 Like

The next step is grammar validation, world model validation, and standard execution, followed by overriding behavior.

I have some ideas of making this a WebAssembly project and also have some ideas for a new UI paradigm.

I can also move the story to its own project and alter the story runner to allow loading the story DLL at runtime.

1 Like

This thread mostly reminds me of working with offshore “coder farms” down to the “limited number of requests” and the “not allowed to write code myself”.

1 Like

There’s zero chance you get code out of ChatGPT without knowing the domain and how to code. It’s generating what you ask it to.

I could write this by myself, but I’m having fun with ChatGPT and I’m using “Design IF Platform,” as a way to test ChatGPT’s true strength.

I’ve also learned a few coding tricks like this

public Grammar The => Article("the");

1 Like

Interesting stuff. Instead of a new IF platform, i’ve been having a go at teaching it an IF language and having it write stuff for me!!

I start:

jon@waa0.com
if i describe a program language can you use it

Yes, as an AI language model, I am able to understand and process descriptions of programming languages. However, I do not have the ability to execute or compile programs directly. I can provide information on the syntax, semantics, and features of different programming languages, as well as general programming concepts and best practices. If you have any specific questions or tasks you would like me to help you with, feel free to ask.
jon@waa0.com
lets call this language "flow"

a bit later, i starts generating Flow programs like this:

My apologies for the mistake. Here's the corrected program:

START
* NAME is a PERSON
* NAME is a ADJ PERSON
* NAME is a PERSON who LIKES ACTIVITY

NAME
* Emma
* Jack
* Olivia

PERSON
* girl
* boy
* woman
* man

ADJ
* tall
* short
* kind
* funny

LIKES
* enjoys
* loves
* hates

ACTIVITY
* swimming
* dancing
* playing chess
* hiking

This program will now emit descriptions of people with varying attributes and interests.
jon@waa0.com
very good!

Thank you, happy to help!

Full transcript for those keen enough. It had a bit of trouble in the middle.

jon@waa0.com
if i describe a program language can you use it

Yes, as an AI language model, I am able to understand and process descriptions of programming languages. However, I do not have the ability to execute or compile programs directly. I can provide information on the syntax, semantics, and features of different programming languages, as well as general programming concepts and best practices. If you have any specific questions or tasks you would like me to help you with, feel free to ask.
jon@waa0.com
lets call this language "flow"

Sure, let's use "Flow" as the name of the hypothetical programming language you are describing. Please go ahead and provide a description of the language and any specific questions you may have.
jon@waa0.com
in flow there are "terms" and "content"

Can you please provide more context and details about what you mean by "terms" and "content" in the context of the Flow programming language? Are these specific keywords or concepts in the language, or are you using them in a more general sense? Additionally, what kind of programming paradigm does Flow follow (e.g. imperative, functional, object-oriented, etc.)? This information will help me better understand the language and provide more accurate responses to your questions.
jon@waa0.com
terms are named in upper case like FRED

Thanks for the additional information. Based on what you've described, it sounds like "terms" in Flow refer to identifiers or names that are used to represent values or objects within the program, and are conventionally written in uppercase letters.

In many programming languages, including Flow, it is common practice to use a consistent naming convention for identifiers, which can help make code more readable and maintainable. Using uppercase letters for terms in Flow is likely a convention that is intended to make them stand out and be easily recognizable as identifiers.

In addition to terms, you mentioned "content" in your earlier message. Could you please clarify what you mean by "content" in the context of Flow? This will help me provide a more complete understanding of the language and its features.
jon@waa0.com
content is everything else that is not a term

Thank you for the clarification. Based on your description, it sounds like "content" in Flow refers to any code or values that are not identified by a term (i.e. an identifier written in uppercase letters). This could include literals (e.g. numbers, strings), operators, function calls, control flow statements, and so on.

In many programming languages, including Flow, the syntax and structure of the language is defined by a set of rules known as a grammar. The grammar specifies how different elements of the language, such as terms and content, can be combined to form valid statements and expressions. Understanding the grammar of a language is essential for writing correct and effective code.

Is there anything else you would like to know about Flow, or any specific questions or tasks you would like me to help you with?
jon@waa0.com
all terms have content, eg 
FRED
the cat sat on the mat.

It's important to note that in programming languages, terms or identifiers are usually used to represent values or objects, and not entire statements or sentences as in natural language.

Based on your example, it seems like "FRED" is a term that represents a value, while "the cat sat on the mat" is a sentence or statement that would be considered content in the Flow programming language.

In Flow, content could be composed of different types of expressions, such as arithmetic expressions, boolean expressions, string expressions, or more complex expressions formed by combining other expressions through operators, function calls, and control flow statements. The specific syntax and semantics of these expressions would depend on the design of the language.

I hope this helps clarify the relationship between terms and content in Flow. If you have any further questions, feel free to ask.
jon@waa0.com
content consists of text and references to terms

Thanks for the additional information. Based on what you've described, it sounds like content in Flow can consist of both textual elements and references to terms. This suggests that terms in Flow may be used to represent variables or values that can be referred to within the textual content of a program.

In many programming languages, it is common to use variables or identifiers to represent values that may change or be used multiple times within a program. By giving these values a name (i.e. a term), it becomes easier to reference and manipulate them throughout the code.

The use of textual content alongside references to terms suggests that Flow may support a form of string interpolation, where variables or terms can be inserted into a string or text output using placeholders or format specifiers. This is a common feature in many modern programming languages and can make it easier to generate dynamic output based on the values of variables or terms.

It's worth noting that the specific syntax and semantics of terms and content in Flow would depend on the design of the language and its grammar. If you have any more questions or would like further clarification, please let me know.
jon@waa0.com
When a term is executed, it emits its content

It's important to clarify that in most programming languages, terms or identifiers do not themselves contain executable code. Instead, terms are used to represent values or objects in a program, which can then be manipulated or processed using various operations and functions provided by the language.

Based on your statement, it sounds like in Flow, terms may have associated content or values that are emitted when the term is referenced or used within the program. This suggests that terms in Flow may be similar to constants or literals in other programming languages.

For example, in JavaScript, the literal 42 represents the value 42, and using the literal in an expression will emit the value itself. Similarly, in Flow, it seems that referencing a term like FRED would emit the associated value or content associated with that term.

It's worth noting that the specific behavior of terms and content in Flow would depend on the design of the language and its grammar, and may differ from other programming languages.
jon@waa0.com
can you tell me what the term FRED would emit

As an artificial intelligence language model, I don't have access to the specific implementation details of the Flow programming language, nor do I have any prior knowledge of what value or content may be associated with the term FRED.

However, based on the convention you described earlier, it is likely that FRED is intended to represent a constant value or object within the program. The specific value or object associated with the term would depend on the context and design of the program.

In general, the term FRED may be associated with any value or object that the programmer chooses to assign to it, as long as it adheres to the rules and conventions of the Flow language.
jon@waa0.com
Suppose the term FRED is defined as:
FRED
The cat sat on the mat.

If the term FRED is defined as "The cat sat on the mat." in Flow, then using FRED in an expression or statement would emit the string "The cat sat on the mat.".

For example, consider the following Flow program:

scss

FRED
print(FRED)

In this program, the first line defines the term FRED to be the string "The cat sat on the mat.". The second line calls the print function and passes FRED as an argument. The print function would then output the string "The cat sat on the mat." to the console.

It's worth noting that the specific behavior of terms and content in Flow would depend on the design of the language and its grammar.
jon@waa0.com
That is not a Flow program. there is no print function instead the program
FRED
The cat sat on the mat

WOld

My apologies for the confusion earlier. Based on your updated description, if the Flow program is:

bash

FRED
The cat sat on the mat.

Then using FRED in an expression or statement would emit the string "The cat sat on the mat.".

For example, consider the following Flow program:

java

FRED
x = FRED

In this program, the first line defines the term FRED to be the string "The cat sat on the mat.". The second line assigns the value of FRED to the variable x, which would then hold the string "The cat sat on the mat.".

It's worth noting that in Flow, the specific syntax and semantics of terms and content would depend on the design of the language and its grammar, and may differ from other programming languages.
jon@waa0.com
your first example is a Flow program, but there is no variable x. Flow has no variables

You're correct, I apologize for the error. Based on your previous description of Flow, it appears that the language does not have variables in the traditional sense. Instead, it uses terms to represent values or objects, which can then be referenced and used throughout the program.

So in the example Flow program:

bash

FRED
The cat sat on the mat.

Using FRED would emit the string "The cat sat on the mat.". For example, if you wanted to output the string to the console, you could use the emit keyword to emit the content of FRED:

FRED
emit FRED

This would output "The cat sat on the mat." to the console.

Once again, I apologize for the confusion earlier, and I hope this clears things up.
jon@waa0.com
that is correct

Thank you for confirming. If you have any further questions about Flow or programming languages in general, feel free to ask.
jon@waa0.com
What does the following Flow program emit:
FRED
The CAT sat on the mat.

CAT
dog

?

Based on the Flow program you provided, here's what each term would emit when used:

    FRED: This term would emit the string "The CAT sat on the mat.".
    CAT: This term would emit the string "dog".
    There is no explicit content associated with the term dog.

So if you were to use these terms in a Flow program like this:

objectivec

FRED
CAT

The program would emit the following output:

arduino

"The CAT sat on the mat."
"dog"

Once again, it's important to note that the specific behavior of terms and content in Flow would depend on the design of the language and its grammar, and may differ from other programming languages.
jon@waa0.com
that is correct, but when content contains the name of another term, that term will be expanded as well. Consider the following Flow program:

FRED
The CAT sat on the mat.

DOG
dog

You're right, I apologize for overlooking that aspect of Flow. In the revised Flow program you provided:

csharp

FRED
The CAT sat on the mat.

DOG
dog

Using the term FRED would emit the string "The CAT sat on the mat.", as before. However, when the string "The CAT sat on the mat." is emitted, the reference to CAT in the string would also be expanded, causing the term CAT to emit its own content. Since CAT is defined as "dog", it would emit the string "dog".

So the final output of the program would be:

arduino

"The dog sat on the mat."
"dog"

I appreciate you bringing this to my attention, and I apologize for any confusion caused by my previous answers. Please let me know if you have any further questions.
jon@waa0.com
that is correct

Thank you for confirming. Is there anything else you would like to know about Flow or programming languages in general?
jon@waa0.com
What does the following Flow program emit:

MOOSE
I am the BIG moose.

BIG
very biggest

Based on the Flow program you provided, here's what each term would emit when used:

    MOOSE: This term would emit the string "I am the BIG moose.".
    BIG: This term would emit the string "very biggest".

So if you were to use these terms in a Flow program like this:

MOOSE
BIG

The program would emit the following output:

arduino

"I am the very biggest moose."
"very biggest"

This is because when the content of MOOSE is emitted, the reference to BIG in the string "I am the BIG moose." is expanded, causing the term BIG to emit its own content. The expanded string becomes "I am the very biggest moose.", which is then emitted by the MOOSE term. The BIG term also emits the string "very biggest" on its own line.

I hope this answers your question. Let me know if you have any further questions.
jon@waa0.com
that is correct

Great, glad to be of help! If you have any more questions or anything else you'd like to know about programming languages, feel free to ask.
jon@waa0.com
Now add in the fact that only the first term of a program is executed

Thank you for clarifying the behavior of the Flow language. If we take into account the fact that only the first term of a Flow program is executed, the output of the program would be:

arduino

"I am the BIG moose."

This is because the first term in the program is MOOSE, which emits the string "I am the BIG moose.". The second term BIG is not executed because it is not the first term in the program.

I hope this answers your question. Let me know if you have any further questions or concerns.
jon@waa0.com
no that is not true. only the first term is executed but terms referenced from the content of that term are also executed.

You are correct, I apologize for my mistake. In Flow, only the first term of the program is executed, but any terms that are referenced in the content of the executed term will also be executed.

So in the given program:

css

MOOSE
I am the BIG moose.

BIG
very biggest

If we execute the term MOOSE, it will emit the string "I am the BIG moose.". Since this string contains a reference to the term BIG, the term BIG will also be executed and emit the string "very biggest". Therefore, the final output of the program would be:

arduino

"I am the very biggest moose."
"very biggest"

Once again, I apologize for the confusion caused by my previous answer. Thank you for bringing this to my attention.
jon@waa0.com
After the term MOOSE is executed which includes executing BIG within its content, then the next term definition BIG will not be executed.

You are correct. Once a term has been executed along with any terms that are referenced in its content, the next term definition will not be executed.

So in the given program:

css

MOOSE
I am the BIG moose.

BIG
very biggest

If we execute the term MOOSE, it will emit the string "I am the very biggest moose.". The term BIG will also be executed and emit the string "very biggest". However, since there are no references to any other terms in the content of the BIG term, the next term definition will not be executed.

Therefore, the final output of the program would be:

arduino

"I am the very biggest moose."
"very biggest"

Thank you for pointing out my mistake earlier, and please let me know if you have any further questions.
jon@waa0.com
no the output will just be "I am the very biggest moose."

You are correct, I apologize for the confusion. Since the BIG term is only executed when it is referenced in the content of the MOOSE term, and the output of the program is only the emitted content from the executed terms, the final output of the program would be:

arduino

"I am the very biggest moose."

Thank you for correcting me, and please let me know if you have any further questions.
jon@waa0.com
that is correct

Thank you for your confirmation. Do you have any other questions or concerns about the Flow language or anything else I can assist you with?
jon@waa0.com
now tell me the output of the following Flow program

START
HELLO WORLD.

HELLO
Hello

WORLD
World

?

The program will emit the following output:

arduino

"Hello World."
"Hello"
"World"

When the START term is executed, it emits the content "HELLO WORLD.". This content contains references to the terms HELLO and WORLD. Therefore, these terms will also be executed and emit the strings "Hello" and "World", respectively.

As a result, the final output of the program will be:

arduino

"Hello World."
"Hello"
"World"

Let me know if you have any other questions or concerns!
jon@waa0.com
No. only "Hello World." will be emitted because only the first term START is executed and its content refererences.

You are correct. I apologize for the mistake in my previous message. Since only the first term START is executed and its content does not reference any other terms, the program will only emit the string "Hello World.".

Therefore, the output of the program will be:

arduino

"Hello World."

Thank you for correcting me. Please let me know if you have any other questions or concerns.
jon@waa0.com
that is correct

Thank you. Is there anything else I can help you with?
jon@waa0.com

Write me a Flow program that emits the following text:
"I am sailing, I am sailing, across the sea."

Certainly! Here's a Flow program that will emit the desired text:

css

SAILING
I am sailing, I am sailing, across the sea.

When executed, the SAILING term will emit the string "I am sailing, I am sailing, across the sea.".

Therefore, the output of the program will be:

css

"I am sailing, I am sailing, across the sea."

Let me know if you have any other questions or if there's anything else I can help you with!
jon@waa0.com
correct

Thank you. Do you have any other questions or concerns?
jon@waa0.com

<SNIP>

jon@waa0.com
Now I am going to add another Flow syntax called "options". The definition of a Flow term can have options indicated by "*". Here is an example:

NAME
* fred
* jim
* tom

Okay, I understand. So the term "NAME" has three options: "fred", "jim", and "tom".
jon@waa0.com
When a term with options is executed, one of the options is chosen at random and executed.

That's correct! When a term with options is executed, Flow randomly selects one of the options and executes it. This allows for some randomness and variability in the output of Flow programs.
jon@waa0.com
What might the following Flow program emit:

START
NAME is a friend of NAME.

NAME
* tom
* jim
* harry

?

The output of this program will be a random selection of the options defined in the NAME term. For example, it might emit "Tom is a friend of Harry" or "Harry is a friend of Jim." It will vary each time the program is executed due to the random selection of the NAME option.
jon@waa0.com
correct

Thank you! Do you have any more questions about Flow or anything else?
jon@waa0.com
What might the following Flow program emit:

STORY
Once upon a time a boy named Tom took a cow to the market. On the way the boy met MAN. The man asked the boy to sell the cow in exchange for BEANS.

MAND
* an old
* a small
* a funny looking
* a strange

MAN
MAND man

BEANS
* some beams
* some frozen chips
* a bike
* a cute puppy


The program might emit something like:

Once upon a time a boy named Tom took a cow to the market. On the way the boy met a small man. The man asked the boy to sell the cow in exchange for some beams.

Or:

Once upon a time a boy named Tom took a cow to the market. On the way the boy met a strange man. The man asked the boy to sell the cow in exchange for a bike.

Or any other combination of options. When the STORY term is executed, it will expand to include the MAN and BEANS terms, which will each randomly select one of their options to include in the final output.
jon@waa0.com
correct

The program might emit:

"Once upon a time a boy named Tom took a cow to the market. On the way the boy met a funny looking man. The man asked the boy to sell the cow in exchange for some frozen chips."

or

"Once upon a time a boy named Tom took a cow to the market. On the way the boy met a small man. The man asked the boy to sell the cow in exchange for a bike."

or any of the other possible combinations.
jon@waa0.com
can you make a Flow program that emits a description of a person using a variety of terms with several options in order to vary the output each time.

Sure! Here's an example:

START
NAME is a PERSONALITY person with COLOR hair and COLOR eyes.

NAME

    Alice
    Bob
    Charlie
    Dave

PERSONALITY

    kind-hearted
    outgoing
    adventurous
    independent

COLOR

    black
    blonde
    brown
    red
    green
    blue
    hazel

This program defines a "person" using various options such as name, personality traits, and physical features. When executed, it will randomly choose an option from each category to create a unique description of a person. For example, it might output "Bob is a kind-hearted person with blonde hair and hazel eyes." or "Alice is an adventurous person with black hair and green eyes."
jon@waa0.com
that is correct

Here's an example Flow program that emits a description of a person using various terms with options:

START
NAME is a DESCRIPTION person with a BODYSHAPE body. They have EYECOLOR eyes and HAIRCOLOR hair.

NAME

    John
    Emily
    Sarah
    Michael

DESCRIPTION

    funny
    serious
    adventurous
    kind

BODYSHAPE

    thin
    athletic
    curvy
    muscular

EYECOLOR

    blue
    brown
    green
    hazel

HAIRCOLOR

    blonde
    black
    brown
    red

When executed, this program will emit a sentence like "John is a kind person with a curvy body. They have blue eyes and red hair." or "Emily is a serious person with an athletic body. They have green eyes and blonde hair." The output will vary each time the program is executed due to the random selection of options.


You are correct, my apologies for the confusion. Here is an updated program:

START
NAME is a person with COLOR hair and a HEIGHT build. They enjoy ACTIVITY in their free time.

COLOR

    red
    blonde
    brown
    black

HEIGHT

    tall
    short
    average height

ACTIVITY

    playing sports
    reading books
    watching movies
    hiking

NAME

    Tom
    Sarah
    Alex
    Emily

BUILD

    athletic
    curvy
    muscular
    slender

This program should emit various descriptions of a person with different hair colors, builds, and activities they enjoy. The use of the NAME term references also adds some variety to the output.
jon@waa0.com
your program is syntactically correct but your term definition BUILD is not referenced anywhere and is therefore redundant.

You're correct! My apologies for the oversight. Here is an updated program that references the BUILD term:

START
NAME is a *BUILD person.

NAME

    tom
    jim
    harry

BUILD

    tall and thin
    short and muscular
    medium build
    with long hair and glasses
    with short hair and a beard

JOB

    a doctor
    a teacher
    a chef
    a software engineer
    an artist

DESCRIPTION
NAME is a BUILD person who works as a JOB.
jon@waa0.com
You can have term references inside optional content. For example what might this Flow program emit:

STORY
Once upon a time a boy named Tom took a cow to the market. On the way the boy met MAN. The man asked the boy to sell the cow in exchange for BEANS.

MAND
* an old
* a small
* a funny looking
* a strange

MAN
MAND man

ADJ
* frozen
* small
* cute

ADJJ
* big
* expensive
* shiny

BEANS
* some ADJ beans
* some ADJ chips
* a ADJJ bike
* a little puppy



This Flow program might emit a story about a boy named Tom who met a man on the way to the market and was offered beans in exchange for selling his cow. The description of the man includes an adjective randomly chosen from the options listed under the term MAND, while the description of the beans includes adjectives randomly chosen from the options listed under the terms ADJ and ADJJ. The output could be something like:

"Once upon a time a boy named Tom took a cow to the market. On the way the boy met a small man. The man asked the boy to sell the cow in exchange for frozen beans. Tom was hesitant, but the small man assured him that the beans were magical. Tom agreed to the trade, and as soon as he took the beans, the ground began to shake. Suddenly, a big, shiny bike appeared out of nowhere. Tom was thrilled with his new acquisition, and rode it home with a smile on his face."
jon@waa0.com
that is not quite correct. you added some output that is not in your program

I apologize for the mistake. Here is the corrected version of the program:

STORY
Once upon a time a boy named Tom took a cow to the market. On the way the boy met MAN. The man asked the boy to sell the cow in exchange for BEANS.

MAND

    an old
    a small
    a funny looking
    a strange

MAN
MAND man

ADJ

    frozen
    small
    cute

ADJJ

    big
    expensive
    shiny

BEANS

    some ADJ beans
    some ADJ chips
    a ADJJ bike
    a little puppy

When executed, this program might emit a sentence like: "On the way the boy met a small man. The man asked the boy to sell the cow in exchange for some frozen beans." or "On the way the boy met a funny looking man. The man asked the boy to sell the cow in exchange for a shiny bike." Each execution would be different due to the use of random options within the definitions.
jon@waa0.com
that is correct.

Great! If you have any more questions or need further assistance, feel free to ask.
jon@waa0.com
can you write a Flow program that emits a description of a person using nested terms to increase variety?

Yes, here is an example Flow program that emits a description of a person using nested terms:

markdown

START
The person's name is NAME. They have a AGE year old ADJ hair and a ADJJ HEIGHT HEIGHT_UNIT tall BODY_TYPE body. They are wearing a COLOR color SHIRT and a PAIR_OF_PANTS. They also have a TYPE_OF_ACCESSORY.

NAME
* John
* Sarah
* Michael
* Emily

AGE
* 20
* 25
* 30
* 35

ADJ
* blonde
* brunette
* red
* black

HEIGHT_UNIT
* inches
* feet
* meters
* centimeters

HEIGHT
* five
* six
* seven
* eight

BODY_TYPE
* slender
* athletic
* curvy
* bulky

COLOR
* red
* blue
* green
* yellow

SHIRT
* t-shirt
* polo shirt
* dress shirt
* sweater

PAIR_OF_PANTS
* jeans
* khakis
* dress pants
* shorts

TYPE_OF_ACCESSORY
* watch
* necklace
* bracelet
* sunglasses

This program uses nested terms to add more variety to the output. For example, the term HEIGHT references another term HEIGHT_UNIT to provide both a height in feet/inches and a height in meters/centimeters. Similarly, the term PAIR_OF_PANTS provides several options for the type of pants a person might be wearing.
jon@waa0.com
that program is not complete. there is no definition for the term ADJJ which is referenced by the term START

My apologies for the mistake. Here's the corrected program:

START
NAME is a ADJ person, who likes to eat FOOD.

NAME

    Tom
    Harry
    Sarah

ADJ

    friendly
    kind
    talkative

FOOD

    pizza
    sushi
    burgers

SAYING

    always says "hello"
    often says "thank you"
    never says "sorry"

START2
NAME is a ADJ person who enjoys eating FOOD and always SAYS.

NAME2

    Tom
    Harry
    Sarah

ADJ2

    friendly
    kind
    talkative

FOOD2

    pizza
    sushi
    burgers

SAYING2

    always says "hello"
    often says "thank you"
    never says "sorry"

jon@waa0.com
that program has no term SAYS defined.

I apologize for my mistake. Here's the corrected program:

START
NAME is a PERSON who wears COLOR clothes. They have EYES eyes and HAIR hair.
SAYS "Hello, my name is NAME."

NAME

    Tom
    Jim
    Harry
    Sarah
    Lily

PERSON

    man
    woman
    girl
    boy

COLOR

    red
    blue
    green
    yellow

EYES

    blue
    brown
    green
    hazel

HAIR

    black
    brown
    blonde
    red

SAYS

    "Hi there!"
    "How are you doing?"
    "Nice to meet you."
    "What brings you here?"

jon@waa0.com
that is correct

Is there anything else I can help you with?
jon@waa0.com
what might the previous Flow program emit

The previous Flow program could emit something like:

"John is a tall, funny guy with big, shiny shoes. He likes to tell jokes and says 'hello' to everyone he meets."

or

"Mary is a short, cute girl with small, expensive earrings. She likes to sing songs and says 'goodbye' to everyone she meets."

The nested terms and options make the output of the program more varied and interesting.
jon@waa0.com
can you improve the program by nesting terms within options?

Sure, here's an example of a Flow program that uses nested terms within options to generate a description of a person with more variety:

markdown

START
The person's name is NAME. They have COLOR hair and COLOR eyes. They are AGE years old.

NAME
* FEMALE
* MALE

FEMALE
* ANNA
* LUCY
* EMMA

MALE
* TOM
* JIM
* HARRY

COLOR
* black
* brown
* blonde
* red

AGE
* YOUNG
* MIDDLE_AGED
* OLD

YOUNG
* Under 20 years old.
* In their teens.

MIDDLE_AGED
* In their 30s.
* In their 40s.
* In their 50s.

OLD
* In their 60s.
* In their 70s or older.

This program randomly selects a name from the options for NAME, then randomly selects colors for their hair and eyes from the options for COLOR, and finally randomly selects an age description from the options for AGE. The AGE term uses nested options to provide a wider variety of age descriptions. The resulting output might look something like:

"The person's name is EMMA. They have black hair and brown eyes. They are in their 40s."
jon@waa0.com
that is almost correct. you must have Emma and not EMMA otherwise EMMA is an undefined term

My apologies for the mistake. Here's the corrected program:

markdown

START
* NAME is a PERSON
* NAME is a ADJ PERSON
* NAME is a PERSON who LIKES ACTIVITY

NAME
* Emma
* Jack
* Olivia

PERSON
* girl
* boy
* woman
* man

ADJ
* tall
* short
* kind
* funny

LIKES
* enjoys
* loves
* hates

ACTIVITY
* swimming
* dancing
* playing chess
* hiking

This program will now emit descriptions of people with varying attributes and interests.
jon@waa0.com
very good!

Thank you, happy to help!
2 Likes

And we’re getting very close to a working demo:

ChicagoDave/chatgpt-ifplatform: I used ChatGPT-4 to design and code an Interactive Fiction platform on top of .NET/C#. (github.com)

1 Like

I should update that I was busy moving in April/May and also turned my focus back to my startup, so this IF C# thing was set aside. I do plan to return to it, especially since I have access to the API which is better for a larger conversation. The LLMs are also improving monthly so when I circle back, I think I’ll have more success.

Will be interested to know if AI is useful in this regard. Presumably you are doing the design and using AI as a code monkey. In this capacity AI might be useful. Although I tried getting it to code and it kept making mistakes. Although that wasn’t the latest. So time will tell.

You have to use ChatGPT 4 otherwise the code is just lies. As a code monkey, v4 is fantastic.

1 Like