Sound in Loop, Message In Loop_fixed

Remember that while the simulation is running, AgentCubes is continuously examining the “While Running” method of every agent. If a rule in that method of an agent has all of its conditions satisfied, the actions of that rule will be performed. In a game-ending situation, the conditions will remain satisfied, so that unless the simulation is stopped, the actions will be repeatedly performed ad infinitum. In the above examples conversational programming is enabled by having clicked on the Frog agent just before the situation occurred, and having the Frog’s behavior window open. Note that the rules are green, indicating that the winning condition – stacked immediately above the flag agent, for example – is satisfied – permanently. Programmers affectionately call this situation an “infinite loop”. Recovering from this can be as simple as clicking on the “Stop Simulation” red button on the world. Or it can require logging off from the computer and logging back in. In the first two examples, AgentCubes will repeatedly initiate the honk sound or text-to-speech translation of the phrase in the “Say” action. It may sound like a stuttering noise. This is a rather obnoxious sound, but simply clicking on the “Stop Simulation” button will stop the simulation and end the sound. The third example is much more problematic. Because the “Show Message” action causes a dialog to pop up, it suspends the simulation until the user clicks on the “OK” button in the dialog window. Unfortunately, because computers process very fast, once the user does click “OK”, the dialog window will immediately pop up. Terminating this situation requires very good hand-to-eye coordination, two hands, and luck. What the user must do with one hand is to press the “Return” or “Enter” key, which closes the dialog, and at essentially the same time click with the mouse on the “Stop Simulation” button. The latter must occur before AgentCubes can re-process the “Show Message” action. The faster the computer, the less likely one will be able to accomplish this. In such situations, one must manually terminate the entire AgentCubes process, either via the Task Manager on a Windows system or via Force Quit on a Macintosh. Unfortunately, since this capability is often restricted to only administrator logins, a student may then be required to logoff and log back in in order to close AgentCubes. As with having to re-create an entire world, most students will remember this lesson with only a single occurrence! Summary: The most important action in a game-ending or simulation-ending rule is to end the game or simulation! A good practice to teach students is to put the simulation-ending action – “stop simulation” or “reload world” – into the rule first. Then test that the simulation works as desired; that is, the conditions for ending the simulation do, in fact, occur and the simulation stops or reloads. Finally, insert other actions, such as sounds and dialogs. Failure to follow this approach can result in a loop from which it is difficult to recover without forcing AgentCubes to quit.
Data
Created:May 28, 2015
Played:123
Agent:11
Rules:27
Methods:13
false
Settings
New Project Name
Rename
Copy
Download
Show Project Report
Flag Project
Delete
Remember that while the simulation is running, AgentCubes is continuously examining the “While Running” method of every agent. If a rule in that method of an agent has all of its conditions satisfied, the actions of that rule will be performed. In a game-ending situation, the conditions will remain satisfied, so that unless the simulation is stopped, the actions will be repeatedly performed ad infinitum. In the above examples conversational programming is enabled by having clicked on the Frog agent just before the situation occurred, and having the Frog’s behavior window open. Note that the rules are green, indicating that the winning condition – stacked immediately above the flag agent, for example – is satisfied – permanently. Programmers affectionately call this situation an “infinite loop”. Recovering from this can be as simple as clicking on the “Stop Simulation” red button on the world. Or it can require logging off from the computer and logging back in. In the first two examples, AgentCubes will repeatedly initiate the honk sound or text-to-speech translation of the phrase in the “Say” action. It may sound like a stuttering noise. This is a rather obnoxious sound, but simply clicking on the “Stop Simulation” button will stop the simulation and end the sound. The third example is much more problematic. Because the “Show Message” action causes a dialog to pop up, it suspends the simulation until the user clicks on the “OK” button in the dialog window. Unfortunately, because computers process very fast, once the user does click “OK”, the dialog window will immediately pop up. Terminating this situation requires very good hand-to-eye coordination, two hands, and luck. What the user must do with one hand is to press the “Return” or “Enter” key, which closes the dialog, and at essentially the same time click with the mouse on the “Stop Simulation” button. The latter must occur before AgentCubes can re-process the “Show Message” action. The faster the computer, the less likely one will be able to accomplish this. In such situations, one must manually terminate the entire AgentCubes process, either via the Task Manager on a Windows system or via Force Quit on a Macintosh. Unfortunately, since this capability is often restricted to only administrator logins, a student may then be required to logoff and log back in in order to close AgentCubes. As with having to re-create an entire world, most students will remember this lesson with only a single occurrence! Summary: The most important action in a game-ending or simulation-ending rule is to end the game or simulation! A good practice to teach students is to put the simulation-ending action – “stop simulation” or “reload world” – into the rule first. Then test that the simulation works as desired; that is, the conditions for ending the simulation do, in fact, occur and the simulation stops or reloads. Finally, insert other actions, such as sounds and dialogs. Failure to follow this approach can result in a loop from which it is difficult to recover without forcing AgentCubes to quit.
Edit Description
Design