Strategy Nice (1) return Honest Strategy Bad return Cheat Strategy TitForTat # donnant-donnant if last == Undef return Honest else return last Strategy TitForTatBad # donnant-donnant, mais triche au début if last == Undef return Cheat else return last Strategy Grim # rancunier def decision = Honest if last == Cheat decision = Cheat; return decision Strategy Rand if Random(2) < 1 return Cheat else return Honest Strategy Majority # décide en fonction de la majorité # des décisions de l'autre def good = 0 def bad = 0 if last == Honest good = good+1; if last == Cheat bad = bad+1; if good >= bad return Honest else return Cheat Constants duration = 10 # durée d'une interaction entre deux invidus meetings = 10000 # nb d'interactions dans un interval intervals = 100 # nb d'intervals initial = 1000 # taille initiale de la population life = 10 # nb d'interactions dans la vie d'un individu spawn = 180 # profit initialement requis pour progénérer mutation = 10 # probabilité mutation (pourcentage) rewardHH = 3 # profit pour honnête si l'autre est honnête rewardHC = 0 # profit pour honnête si l'autre triche rewardCH = 5 # profit pour tricheur si l'autre est honnête rewardCC = 1 # profit pour tricheur si l'autre triche