Source code for egttools.behaviors.CRD.moving_average
# Copyright (c) 2019-2021 Elias Fernandez## This file is part of EGTtools.## EGTtools is free software: you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation, either version 3 of the License, or# (at your option) any later version.## EGTtools is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with EGTtools. If not, see <http://www.gnu.org/licenses/>from.importAbstractCRDStrategy
[docs]def__init__(self,a0:int,aa:int,am:int,ab:int,group_size:int):""" A CRD strategy which adapts in function of a moving average of the contributions of the rest of the group. Parameters ---------- a0: int how much to contribute in the initial round. aa: int how much to contribute when you have contributed above the average of the group in the previous round. am: int how much to contribute when you have contributed equal to the average of the group in the previous round. ab: int how much to contribute when you have contributed below the average of the group in the previous round. group_size: int Size of the group. """super().__init__()self.a0_=a0self.aa_=aaself.am_=amself.ab_=abself.last_action_=self.a0_self.nb_opponents_=group_size-1