NetLogo banner

 Home
 Download
 Help
 Resources
 Extensions
 FAQ
 References
 Contact Us
 Donate

 Models:
 Library
 Community
 Modeling Commons

 User Manuals:
 Web
 Printable
 Chinese
 Czech
 Japanese

  Donate

NetLogo User Community Models

(back to the NetLogo User Community Models)

rescue the princess

by Sebastien Picault (Submitted: 03/07/2014)

[screen shot]

Download rescue the princess
If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".(The run link is disabled because this model uses extensions.)

# WHAT IS IT?

This model uses extensions. Find the full model at: http://www.lifl.fr/SMAC/projects/ioda/ioda_for_netlogo/examples/rescue-the-princess.html

This model demonstrates goal-driven behaviors. The character (knight) can perform several interactions which are hierarchized so as to make it search and reach its goals. Basically the main goal of the knight is to rescue the princess which is somewhere in the maze. The knight can either have an exhaustive view (or "omniscient") of the maze, or on the contrary only see a small part and what has been explored. The state of the doors is not known before the knights explicitly checks wether they are locked, closed or open. When a door is locked, the appropriate key (i.e. with the matching color) is required. The knight uses a stack of goals so as to execute the appropriate actions.

The knight is also endowed with **personality traits** which influences the interactions that are chosen in a given situation and thus introduces diversity in the outcome of the simulation. The first one is the **mood**: an optimistic knight considers that doors which are still in an unknown state are easy to open, thus he takes them into account to compute the shortest path to his target. On the contrary, a pessimistic knight avoids doors with an unknown state as much as possible. The second personality trait is the **ordering of goals**. A rigid (psychotic ?) knight uses the stack of goals in a strict order, and must fulfill the first goal before it can take into account the other ones. On the contrary, a flexible use of the stack of goals allows to remove obsolete goals when a higher level target is reached (e.g. why matter opening all the doors when the princess is before you?). The last personality trait is the way to **execute the plan**.
When an opportunistic knight finds a key, he takes it, be it useful or not, while an utilitarian knight takes only the keys that are needed to unlock doors.
Besides, we provide several maps that illustrate the differences between the resulting behaviors.

# HOW TO USE IT

* Choose the the personality traits, the vision of the knight and a map of the maze, then click on **`setup`**.
* Click on **`go`** (or **`go-once`** for step-by-step execution) and observe the behavior of the knight. The thoughts and decisions of the knight are shown in the output area at the bottom of the window; the monitors also show the keys own by the knight, the other agents that are discovered at each exploration step, and the stack of goals (new goals appear at the beginning of the list)
* You can toggle the logging of performed interactions, decide whether doors are locked at startup or only closed, and toggle the patch labels that show the number of steps to the goal of the knight (Dijkstra algorithm). The plot shows the proportions of unexplored patches, of agents that have been discovered by the knight, of doors that have been checked and of collected keys.

# THINGS TO NOTICE

The behavior of the knight is not completely deterministic, since several goals or paths may be equivalent in terms of Dijkstra distance.
Yet, most of the maps are designed to demonstrate the differences between personality traits.

You can also draw you own maps in a text file. The first line is a comment or title, the second line is a list with the dimensions ([width height]) of the map, then each line encodes a line of the map: **W** for walls, ' ' for empty space, **K** for the knight, **P** for the princess, **B** (resp. **R**, **Y**, **G**) for the blue (resp. red, yellow, green) door, **b** (resp. **r**, **y**, **g**) for the blue (resp. red, yellow, green) key, **D** for closed (unlockable) doors.

# IODA NETLOGO FEATURES

This model makes an intensive use of one of the new features introduced in IODA 2.2: the ability to specify easily alternatives in the triggers or conditions of the interactions. For instance, please consider the "MoveTowards" interaction, which incites the knight to move in the direction of its goal when possible:

parallel interaction MoveTowards
trigger target-matches-goal?
condition direct-path-to-target? shortest-path-free?
condition possible-path-to-target? optimistic? shortest-path-free?
actions remember-path-to-target choose-shortest-path move-one-step
end

The trigger simply verifies that the target of the interaction is the first goal of the knight. Yet, there are two possible conditions depending on the mood of the agent. In any case, the knight can perform MoveTowards if there is a free path (without obstacles) to the target. But, if the knight is optimistic, he will also try to move towards its goals if there is a "possible" path, i.e. through doors even in an unknown state.
The interaction is realizable if 1) the trigger is fulfilled and 2) at least ONE of the conditions is verified.

# THINGS TO TRY

You can extend this model at will by introducing new personality traits and new characters. For instance, you can first try to use several knights and princesses (with the ability of being cooperative or not)! Or add a nasty dragon which can defeated only by brave knight (while cowards just flee). Have fun !

# HOW TO CITE

* The original "Princess" model was designed by Jean-Christophe Routier and Philippe
Mathieu to illustrate cognitive behaviors. The corresponding applet can be found there:
http://www.lifl.fr/SMAC/projects/cocoa/princesse.html
* The **IODA methodology and simulation algorithms** (i.e. what is actually in use in this NetLogo extension):
Y. KUBERA, P. MATHIEU and S. PICAULT (2011), "IODA: an interaction-oriented approach for multi-agent based simulations", in: _Journal of Autonomous Agents and Multi-Agent Systems (JAAMAS)_, vol. 23 (3), p. 303-343, Springer DOI: 10.1007/s10458-010-9164-z.
* The **key ideas** of the IODA methodology:
P. MATHIEU and S. PICAULT (2005), "Towards an interaction-based design of behaviors", in: M.-P. Gleizes (ed.), _Proceedings of the The Third European Workshop on Multi-Agent Systems (EUMAS'2005)_.
* Do not forget to cite also **NetLogo** itself when you refer to the IODA NetLogo extension:
U. WILENSKY (1999), NetLogo. http://ccl.northwestern.edu/netlogo Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.

# COPYRIGHT NOTICE

All contents © 2008-2013 Sébastien PICAULT and Philippe MATHIEU
Laboratoire d'Informatique Fondamentale de Lille (LIFL), UMR CNRS 8021
University Lille 1 --- Cité Scientifique, F-59655 Villeneuve d'Ascq Cedex, FRANCE.
Web Site: http://www.lifl.fr/SMAC/projects/ioda

The IODA NetLogo extension is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

IODA NetLogo extension is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the IODA NetLogo extension. If not, see http://www.gnu.org/licenses.

(back to the NetLogo User Community Models)