International Competition in the Programming

ICP 98

Problem of correspondence stage

Spiders

There are two sorts of "spiders" (X and Y) living on an island. Spiders are metal robots and they consume metal. Spider can eat another spiders but only those of another sort.

Sunshine is the source of energy for spiders.

Y-spiders have accumulators that are recharging during the day. Y-spiders can move during the day and also during the night but are slower than X-spiders.

X-spiders have no accumulators thus they can not move during the night. They are faster than Y-spiders during the day.

Spiders consume all metal food in their way.

Direction of move of spiders is randomly changed after collision of two spiders of the same sort, after bumping into a wall and after reaching water.

X-spider wins fight with Y-spider with adjustable probability during the day. Y-spider wins fight with X-spider with adjustable probability during the night. The winner always eats beaten spider.

Spider will reproduce itself when he reaches double of its initial weight. In such case from the spider will be detached a new spider whose weight will be one unit.

Task

Create a programm which will simulate life of spiders on the island and meets following criteria:

  1. User will be able to create an island (place for simulation) on rectangular area by the mouse.
  2. User will be able to create walls on the island by the mouse.
  3. User will be able to select number and speed of spiders of each sort separately, probabilities of winning after collision, total weight of metal food (given relatively to spider weight) and number of pieces to which will be the food split.
  4. User will be able to select length of the day and length of the night in seconds.
  5. Initial position of spiders and food will be generated randomly.
  6. User will be able to start and stop simulation of life on island. Spiders will start moving in random directions after start of simulation. Programm will show continuously island, walls, spiders, food and numbers of spiders.