Alternative distance calculation 

Hello, All!

1. How can I modify the way the distance is calculated? I want to calculate
it for current coordinates and the coordinates at birth. I hope it will help
to evolve a more good-looking straight movement. I've played with experiment
definition files, but with no luck.

With best regards, Andrey Lipatkin.

Forums: 
Maciej Komosinski's picture

> 1. How can I modify the way the distance is calculated? I want to calculate
> it for current coordinates and the coordinates at birth. I hope it will help
> to evolve a more good-looking straight movement. I've played with experiment
> definition files, but with no luck.

You can simply increase the "performance sampling period" parameter.

If you want to modify the expdef, then you can, for example,
in function onBorn()
set Creature.user1 to Creature.pos_x and user2 to position y,

in function onCreaturesUpdate(cr)
compute and set Creature.distance based on Creature.pos
and Creature.user fields.

If it doesn't work (ie. the distance will be overwritten
by the standard distance computation), you will have (
instead of onCreaturesUpdate) to modify the
function updatePerformanceWithPopSize()
(see scripts_sample/standard_tricks.expdef) to set
Genotype.distance computed as advised above.

Good luck!

MacKo