selfmask and othermask and genotypelibrary.worst 

I've been trying to map my old working colmask values Creatures : 4 and
Food : 148 to new ones. This way my creatures don't collide and are not
handled in the script and the food is only handled in the script
According to my understanding of the reference browser this should
translate to: Creatures -> selfmask:0x10000 othermask:0x20001 and Food
-> selfmask:0x20002 othermask:0x10002. But this only seems to work for
creatures. When a creature bumps into food nothing happens while it
should work because the AND values for a food-creature collision are
0x10000 or 0x20000 which should activate the handler in my script.

I am now back to the old colmask values but just wondered what I screwed
up.

Another thing is that it seems that the standard script only removes one
genotype INSTANCE as a result of the GenotypeLibrary.worst call instead
of the entire genotype and doesn't update the fitness. Does anyone know
anything about this. Because I first thought it removed an entire
genotype including all instances but that seems not to be the case.

Regards,

Tom

Forums: 
Szymon Ulatowski's picture

Tom Schut wrote:
> I've been trying to map my old working colmask values Creatures : 4 and
> Food : 148 to new ones. This way my creatures don't collide and are not
> handled in the script and the food is only handled in the script
> According to my understanding of the reference browser this should
> translate to: Creatures -> selfmask:0x10000 othermask:0x20001 and Food
> -> selfmask:0x20002 othermask:0x10002. But this only seems to work for
> creatures. When a creature bumps into food nothing happens while it
> should work because the AND values for a food-creature collision are
> 0x10000 or 0x20000 which should activate the handler in my script.
>
> I am now back to the old colmask values but just wondered what I screwed
> up.

actually, you are already using these new fields :-)
since the new masks were introduced, the old colmask is not anymore used
directly in the application. instead, selfmask/othermask are calculated
automatically whenever the colmask is set.
it means there is a very simple way for converting any script to use new
fields: simply see what values are in selfmask/colmask.

(the automatically calculated selfmask/colmask configuration may use
"too many" bits and be less understandable than a hand crafted one :-P
but it does not influence the performance)

simple food/creature collision example:
creatures: self=0x0 other=0x10000
food: self=0x10000 other=0

> Another thing is that it seems that the standard script only removes one
> genotype INSTANCE as a result of the GenotypeLibrary.worst call instead
> of the entire genotype and doesn't update the fitness. Does anyone know
> anything about this. Because I first thought it removed an entire
> genotype including all instances but that seems not to be the case.

you mean function LimitGenePoll() calling GenotypeLibrary.del1Genotype?
(GenotypeLibrary.worst just returns the genotype index, it does not
remove anything).
well, this is consistent with the general idea behind the
standard.expdef - a single item in the genotype list represents a set of
identical genotypes. removing a genotype does not remove the whole set,
unless there is only one instance left.
of course you could introduce different rules in a custom experiment
definition and use GenotypeLibrary.delGenotype() to remove the genotype
completely.

sz.