Last Modified: $Date: 2002/02/01 14:28:09 $ by $Author: ferret $


Content of XML files

In this file you will find the XML specification for each type of object that is able to be represented in XML.
The organisation is always the same:

Food Map

A food map is defined as below:
[1] <?xml version="1.0" encoding="UTF-8"?>
[2] <FOODMAP size="4">
[3]   <FOOD type="B" value="0.60541725" color="black"/>
[4]   <FOOD type="s" value="0.24649799" color="red"/>
[5]   <FOOD type="A" value="0.054020107" color="0,0,0"/>
[6]   <FOOD type="n" value="0.1527639" color="black"/>
[7] </FOODMAP>
A food map has only one attribute (size ligne [2]) that represents the number of foods it contains.

Food

All foods contained in the food map body will be part of the food map.
A food has three attributes:
  - a type, that represents its name. This name must be unique.
  - a value, that represents the amount of energy won (or lost) by a worm when it eats it. This value can be negative.
  - a color, that represents the color of the food. This argument is used only when there is a visual representation of the food. The color can be represented by a string like "red", or simply by a RGB representation like "10,15,67".

Errors management: XML Handler:

Life Room

A life room is defined as below:
[1] <?xml version="1.0" encoding="UTF-8"?>
[2] <LIFEROOM type="fr.lifl.aquarium.model.CharMatrix" width="5" height="50">
[3]   <ROOM linear="0" value="a"/>
[4]   <ROOM linear="1" value="1"/>
[5]   <ROOM linear="20" value="a"/>
[6] </LIFEROOM>
A life room has three attributes:
  - type that represents the type of life room.
  - width the width of life room.
  - height the height of life room.

Room

All rooms contained in the life room body will be part of the life room.
All rooms absent will be presumed as empty rooms.
A room has two attributes:
  - a linear, that represents the linear coordinate of this room. A linear coordinate is a coordinate that follow the rule: linear=y*width+x. It is always comprised in [0, width*height[.
  - a value, that represents the contents of the room. Value "1" is reserved for wall and "2" is reserved to worms body. Other letters will be considered as food types.

Errors management: XML Handler:

A Worm

A worm is defined as below:
[01] <?xml version="1.0" encoding="UTF-8"?>
[02] <WORM age="427" name="5729904" direction="R" life="-1374.75">
[03]   <DNA foodsType="CBA" color="73,240,170" isPerfect="false" length="6">
[04]     <HALO type="fr.lifl.aquarium.model.halo.ProportionalHalo" size="3"/>
[05]     <GENE key="IAC" value="FRL"/>
[06]     <GENE key="IAB" value="FLR"/>
[07]     <GENE key="BBC" value="LFR"/>
[08]      <...>
[09]     <GENE key="BBB" value="RLF"/>
[10]     <GENE key="BBA" value="FRL"/>
[11]     <GENE key="IAI" value="FLR"/>
[12]   </DNA>
[13]   <BODY>
[14]     <COORDINATE x="117" y="62"/>
[15]     <COORDINATE x=116" y="62"/>
[16]     <COORDINATE x="116" y="61"/>
[17]     <COORDINATE x="117" y="61"/>
[18]     <COORDINATE x="118" y="61"/>
[19]     <COORDINATE x="119" y="61"/>
[20]     </BODY>
[21]   </WORM>
A Worm has four attributes:
  - age that represents the number of turn since he is alive.
  - name its name.
  - direction where it is looking at R for Right, L for Left, F for Front and D for Down.
  - life the amount of energie it has.

Errors management for Worm's attributes: A Worm is composed by
  - DNA that represents its Dna
  - BODY that represents its body

DNA

A DNA has four attributes:
  - foodsType that represents types of food known by the worm.
  - color the color of the worm.
  - isPerfect is a boolean value that indicates if this worm is perfect or not.
  - length the size of the worm.

Errors management for DNA's attributes: A DNA is composed by
  - HALO that represents the halo of the worm.
  - GENE that represents a gene of the DNA.

Halo

A HALO has two attributes:
  - type that represents its type. Means how is computed the look algorythm
  - size the maximum visibility range of the halo.

Errors management for HALO's attributes:
  • if the type attribute is empty or absent parsing will stop.
  • if the type attribute is an unknown class then parsing will be stopped .
  • if the size attribute is empty, absent or not a valid positive integer then parsing will be stopped.
  • if the size attribute does not respect range defined in preferences then parsing will continue.

Gene

A GENE has two attributes:
  - key that represents what sees the worm. This key is composed of 3 letters. First letter represents what's on the left of the worm, second letter is what can see the worm in front of him, and last letter is what's on its right.
  - value that expresses how will react the worm. Here, each letter is a move, R means move Right, L means move Left, F means move Front.
So, if a key is "AII" and the value is "RFL", it means that if the worm's Halo says "I am able to see AII", then the worm will try to move first in the Right direction, if it can't it will try Front, and finaly it will try Left.
The "I" letter is reserved, and means nothing (walls, empty square, worms, in fact all that is not identified as a food type).

Errors management for GENE's attributes:
  • if the key attribute is empty or absent parsing will stop.
  • if the value attribute is empty or absent parsing will stop. A value should always be composed by 3 different letters, a value with "FFF" is meaningless and should not be used, but if it does, it won't stop the parsing

Body

A BODY has no attribute, but is composed of COORDINATE tags.
A COORDINATE has two attributes that indicates where is located the body of the worm.
  - x that represents the x coordinate of this body part.
  - y that represents the y coordinate of this body part.

Errors management for BODY's attributes:
XML Handler: