> For the complete documentation index, see [llms.txt](https://mindengage.gitbook.io/mindengage-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mindengage.gitbook.io/mindengage-docs/examples/simulation-generation-examples.md).

# Simulation Generation Examples

Example prompts for 2D/3D interactive visual simulations

MindEngage Author provides two powerful methods for generating 2D and 3D interactive simulations:

1. **Automatic Generation:** Simply select a passage from your lesson, and the AI will analyze the text to design and create a relevant simulation automatically.
2. **Manual Prompting:** Write a detailed description (a "prompt") to give the AI specific instructions on the simulation you want to build.

This guide provides examples for the second method: generating simulations by writing a custom prompt.

{% hint style="warning" %}
**What if the generated simulation isn't quite right?**

It's common for the first result to need adjustments. You have two options for refinement:

* **Regenerate:** If the simulation fundamentally misses your requirements or is very different from what you envisioned, it's best to **refine your prompt** with more detail and generate a new simulation from scratch.
* **Edit:** For minor adjustments—such as changing a color, tweaking a label, or correcting a small behavior—you can issue an **edit prompt** to ask the AI to make a specific modification to the existing code.
  {% endhint %}

### Example-1: **Interactive "Find Maximum" Simulation**&#x20;

See the simulation [**here**](https://storage.googleapis.com/interactivebooks-dev/website/foundations_of_computer_science_an_interactive_introduction-48/visuals/understand_1607.html)

From [course](https://storage.googleapis.com/interactivebooks-dev/website/foundations_of_computer_science_an_interactive_introduction-48/index.html) / [lesson](https://storage.googleapis.com/interactivebooks-dev/website/foundations_of_computer_science_an_interactive_introduction-48/algorithmic_thinking_and_problem_solving.html)

```
Create an interactive 2D simulation to explain the algorithm for finding the maximum value in a list of numbers.

The visualization must include three main components that update in sync:

    Bar Chart: A dynamic bar chart representing the list of random numbers. Use distinct colors to highlight the algorithm's state: one color for the current maximum value found so far, and another for the element currently being compared.

    Pseudocode View: A panel displaying the step-by-step pseudocode for the 'find max' algorithm. The currently executing line must be highlighted.

    Flowchart View: A diagram using standard flowchart symbols (start/end, process, decision) to show the algorithm's logic. The currently active logical step (node) must be highlighted.

Provide the following user controls in a GUI panel:

    A slider to adjust the number of items in the list.

    A slider to control the animation speed.

    A "Run" button to start the simulation.

    A "Reset" button to generate a new random list.

    A "Help" button that shows an overlay explaining the visualization.

The overall layout should be responsive, adapting the component positions for both wide and narrow screens.
```

#### How this prompt maps to the UI :

* **"Give your concept for the diagram"**: The text above is entered here.
* **"Visual Name"**: Findmax ALgorithm
* **"Simulation Type"**: 2D Simulation
* **"Accuracy Level"**: Advanced LLM (Required for this level of complexity).

### Example-2:  Visualizing Gradient Descent on a Complex 3D Surface

See the simulation [**here**](https://storage.googleapis.com/interactivebooks/website/applied_machine_learning_made_interactive-114/visuals/gradient-descent_1218.html)

From [course](https://storage.googleapis.com/interactivebooks/website/applied_machine_learning_made_interactive-114/index.html) / [lesson](https://storage.googleapis.com/interactivebooks/website/applied_machine_learning_made_interactive-114/predicting_with_singlevariable_linear_regression.html)

```
Create an interactive 3D simulation to explore the gradient descent algorithm on a complex, non-convex cost surface, inspired by the provided image.

The simulation must feature:

    A Procedural 3D Surface: Generate a 3D landscape representing a cost function. It should be composed of a main quadratic basin with several superimposed Gaussian "peaks" and "valleys" to create multiple local minima and maxima, similar to the topography in the image.

    Animated Walker: A sphere that animates its movement down the surface, step-by-step, according to the gradient descent algorithm. Its path should be traced with a colored line to show the full trajectory.

    Comprehensive GUI Controls: Integrate a panel with controls for:

        Surface Shape: Sliders to modify the number, type (peak/valley), position, width, and depth of the landscape features.

        Optimizer Settings: A dropdown to select the optimization algorithm (e.g., Batch, Mini-batch, SGD) and sliders for related parameters like noise level.

        Descent Parameters: Controls for the learning rate (η), the walker's starting position on the surface, and the maximum number of steps.

    Real-time HUD: A small, fixed overlay on the screen that displays the walker's current coordinates (θ₀, θ₁) and the cost (J) value at its position.
```

#### How this prompt maps to the UI :

* **"Give your concept for the diagram"**: The text above is entered here.
* **"Visual Name"**: Gradient Descent Explorer
* **"Simulation Type"**: 3D Simulation
* **"Accuracy Level"**: Advanced LLM (Required for this level of complexity).
* **"Include Image (file or paste)"**: The user would check this box and upload their reference image of the desired landscape.

### Example-3: A 3D interactive diagram that explains a system architecture

See the simulation [**here**](https://storage.googleapis.com/interactivebooks/website/embedded_system_programming-132/visuals/integration_1528.html)

From [course](https://storage.googleapis.com/interactivebooks/website/embedded_system_programming-132/index.html) / [lesson](https://storage.googleapis.com/interactivebooks/website/embedded_system_programming-132/capstone_project_building_an_embedded_iot_application.html)

```
Create an interactive 3D diagram that visualizes the integration and interfacing of core components in a robotics system. The simulation should feature a humanoid robot whose appearance is based on the provided reference image.

The diagram must include the following elements:
1.  **System Components:** Represent the following components as labeled 3D boxes arranged in a clear layout:
    *   Microcontroller (MCU)
    *   Sensors
    *   Analog-to-Digital Converter (ADC)
    *   Servos
    *   Motor Drivers
2.  **Image-Inspired Robot:** Include a 3D model of a humanoid robot. Its design, style, and proportions should be directly inspired by the provided image. This robot should be placed to the side of the component diagram.
3.  **Data Pathways:** Draw curved and dashed lines connecting the components to illustrate data and control flow, including paths like:
    *   Sensors to ADC and MCU
    *   MCU to Servos and Motor Drivers
    *   Feedback loops from Servos/Drivers back to the MCU
4.  **Interactive Integration Stages:** The core of the simulation is a `dat.gui` control panel that lets the user step through different 'Integration Stages'. Selecting a stage should visually activate the relevant components and data paths by changing their color and opacity. The stages should include:
    *   Sensors to MCU
    *   ADC Path
    *   MCU to Servos
    *   Full System
5.  **Animated Data Flow:** When a data path is active, animate small, glowing particles traveling along the lines to represent the flow of information.
6.  **Full System Animation:** When the "Full System" stage is selected and a "Run Animation" control is enabled, the robot model itself should perform a walking animation and move in a circular path to demonstrate a fully operational system.
```

#### How this prompt maps to the UI

* **"Give your concept for the diagram"**: The detailed, multi-point prompt above is entered into this main text field.
* **"Visual Name"**: Robotics Integration Diagram
* **"Simulation Type"**: 3D Simulation.
* **"Accuracy Level"**: Advanced LLM. y.
* **"Include Image (file or paste)"**: This must be **checked**. The user would then upload the reference image of the robot"
