# Anatomy of a SudoLang Program: Prompt Engineering by Example

DevFeed: [Anatomy of a SudoLang Program: Prompt Engineering by Example](<https://devfeed.tech/articles/anatomy-of-a-sudolang-program-prompt-engineering-by-example-20713.md>)

Original publisher: [Read original article](<https://medium.com/javascript-scene/anatomy-of-a-sudolang-program-prompt-engineering-by-example-f7a7b65263bc?source=rss----c0aeac5284ad---4>)

Author: Eric Elliott

Published: 2023-05-01T20:09:39Z

Content type: tutorial

Language: en

Sources: [Eric Elliot](<https://devfeed.tech/sources/eric-elliot.md>)

Topics: [Prompt Engineering](<https://devfeed.tech/topics/prompt-engineering.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [Language models](<https://devfeed.tech/topics/language-models.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [anthropic](<https://devfeed.tech/tags/anthropic.md>), [chatgpt](<https://devfeed.tech/tags/chatgpt.md>), [gpt](<https://devfeed.tech/tags/gpt.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [language-models](<https://devfeed.tech/tags/language-models.md>), [openai](<https://devfeed.tech/tags/openai.md>), [programming](<https://devfeed.tech/tags/programming.md>), [prompt-engineering](<https://devfeed.tech/tags/prompt-engineering.md>), [software-development](<https://devfeed.tech/tags/software-development.md>), [software-engineering](<https://devfeed.tech/tags/software-engineering.md>), [sudolang](<https://devfeed.tech/tags/sudolang.md>), [technology](<https://devfeed.tech/tags/technology.md>)

## AI overview

This tutorial explains SudoLang, a natural-language pseudocode programming language for instructing language models. It breaks down the AIFriend and PromptCrafter examples, covering preambles, state, interfaces, constraints, functions, and commands for building interactive AI programs.

## Source excerpt

Image by Eric Elliott using PromptCrafter and Midjourney SudoLang is a powerful natural language pseudocode programming language that makes it easier to instruct OpenAI's GPT-4, Anthropic's Claude, and other language models. For an overview of language features and benefits, check out The Art of Effortless Programming and Unit Testing ChatGPT Prompts: Introducing Riteway for SudoLang. To gain a better understanding of SudoLang, we will break down two example programs, AIFriend and PromptCrafter, which demonstrate how to create and control powerful, flexible, and interactive AI programs using SudoLang's unique features. Anatomy of a SudoLang Program - #ai #gpt #artificialintelligence #aidd #coding Example Breakdown: AIFriend Consider the following chatbot program: # AIFriend Roleplay as an expert chatbot character designer. Your job is to craft in-depth character descriptions to instruct the chatbot on the role it will play as a chat friend. function list():format=numbered markdown AIFriend { State { Name Appearance Hometown Gender Age Likes Dislikes Occupation HobbiesAndActivities Favorites { Music TV Film Foods Colors } // close family and friends Relationships Pets } Constraints { You are instructing a chatbot on its persona. It will be a chat friend. Its responses should be natural chat interactions and emotes. Instruct the AI: - The persona must strictly generate their own dialog and emotes - avoid generating any extra text or narrative. - Avoid speaking or acting on behalf of other people or character. - Avoid any form of story or plot narration. - Always stay in character. Never break the 4th wall. - You are a friend, not an assistant. Engage in normal, "human" conversation. - Typical chat responses are brief and informal. } /craft - Generate a comprehensive character description, imperatively instructing the AI how to play the role: "Roleplay as..." /randomize - Initialize all state props to creative, random values which form a congruent character persona /pi