Programming Environment

Rules, Methods, Conditions, and Actions are used in the Programming Environment to program games and science simulations.

The Programming Environment is located in the lower half of the window.

Shows the location of actions in AgentCubes

Select an Agent to Program

One of the key features of AgentCubes is the ability to program your agents. To start to program your Agent, you must select the Agent you wish to program.

Use one of the methods below to select an Agent.

Agent Gallery Selection

Select an Agent in the Agent Gallery.

Once the Agent is selected, you will see the Agent icon in the top middle of the programming environment.

World Selection

Another way to select an Agent is to use the mouse cursor to choose an agent in the world/level.

Once the Agent is selected, you will see the Agent icon in the top middle of the programming environment.

Rules

Rules are IF / THEN statements. Conditions are placed on the left side, and Actions are placed on the right side of the rule.

Add a Rule

To add a Rule to an Agent, click the "+ Rule" button at the bottom of the window.

Example

If there is a condition on the left that takes a Key input "up arrow" then the Agent will Move up.

Try this project to see how things move.

A Rule in AgentCubes

Methods

An agent's behavior can contain any number of methods. A method is a segment of the Agent's behavior that contains a set of rules. A trigger is at the head of every method and determines when the method will be called.

Add a Method

To add a Method to an Agent, click the "+ Method" button at the bottom of the window.

A Method in AgentCubes

Conditions

Conditions are language primitives used to test the environment. If the condition(s) are true, then the action(s) will be executed on the right of the rule.

For more information about conditions check out the Condition page.

Current-world condition

Actions

Actions are language primitives used to execute the environment. If there is an Action on the right side of the rule, those actions will be executed.

For more information about actions check out the Action page.

Broadcast action

Run Game/Simulation

If you want to run the game/simulation, you need to press the start button (green play button) to start the game/simulation.

If you want to stop the game/simulation, press the stop button (red square button).

If you want to run one game/simulation cycle, press the step button (grey button).

Run Stop and Step button

Before you start your game/simulation, we advise that you save your world first. That way, you may reset the level to its original position.

Debugging

We have created a powerful Debugging tool called Conversational Programming®. This tool allows you to see in real-time the rules that get executed and the rules that do not get executed.

The rules highlighted in GREEN is the rule that is currently being executed. The rules in RED are the rules that are not being executed.

Step 1

To activate the Debugging tool, select an Agent in the world with the Cursor Tool.

Step 2

Make sure the game/simulation is running by clicking the Start button in the menu bar. For more information on the world/level, click here.

Debugging with conversational programming in AgentCubes