Yes-or-no-dialog Condition

From AgentCubes
Jump to navigation Jump to search

Yes-or-no-dialog condition.png

Definition: The Yes or No Dialog condition lets you write programs that can ask users yes/no questions and act based on their answer. Both the questions asked and the labels for the Yes/No answers can be customized by changing the text fields in the condition.

If the user answers "Yes", the condition is true. If the user answers "No", the condition is false.

Parameters: string
Example: You can get control over the Shark in the Fish Tank project and decide whether the Shark eats the fish or not.

SeeFishInFrontOfMe.png

This is the behavior in the while-runnung method. When the shark sees the fish in front of it, there is a ten percent change that the eat_fish method is invoked.


EatFishMethode.png

In the eat_fish method, the yes-or-no-dialog condition can help to decide whether the fish should be eaten or not.


Yes-or-no-dialog.png

When the Shark encounters the Fish, it asks the user whether it should eat the poor little fishy. If you are feeling mean today, tell him to go for it, but if you want to save the fish, tell the Shark to stay away!