Beispiel #1
0
    def test_is_basic(self):
        """A test that verifies if the is_basic function works correctly"""
        known_cheaters = [
            axelrod.Darwin, axelrod.Geller, axelrod.GellerCooperator,
            axelrod.GellerDefector, axelrod.MindBender, axelrod.MindController,
            axelrod.MindWarper, axelrod.MindReader
        ]

        known_basic = [
            axelrod.Alternator, axelrod.AntiTitForTat, axelrod.Bully,
            axelrod.Cooperator, axelrod.Defector, axelrod.SuspiciousTitForTat,
            axelrod.TitForTat, axelrod.WinStayLoseShift
        ]

        known_ordinary = [
            axelrod.AverageCopier, axelrod.ForgivingTitForTat,
            axelrod.GoByMajority20, axelrod.GTFT, axelrod.Grudger,
            axelrod.Inverse, axelrod.Random
        ]

        for strategy in known_cheaters:
            self.assertFalse(axelrod.is_basic(strategy()), msg=strategy)

        for strategy in known_basic:
            self.assertTrue(axelrod.is_basic(strategy()), msg=strategy)

        for strategy in known_ordinary:
            self.assertFalse(axelrod.is_basic(strategy()), msg=strategy)
Beispiel #2
0
    def test_is_basic(self):
        """A test that verifies if the is_basic function works correctly"""
        known_cheaters = [
            axelrod.Darwin,
            axelrod.Geller,
            axelrod.GellerCooperator,
            axelrod.GellerDefector,
            axelrod.MindBender,
            axelrod.MindController,
            axelrod.MindWarper,
            axelrod.MindReader,
        ]

        known_basic = [
            axelrod.Alternator,
            axelrod.AntiTitForTat,
            axelrod.Bully,
            axelrod.Cooperator,
            axelrod.Defector,
            axelrod.SuspiciousTitForTat,
            axelrod.TitForTat,
            axelrod.WinStayLoseShift,
        ]

        known_ordinary = [
            axelrod.AverageCopier,
            axelrod.ForgivingTitForTat,
            axelrod.GoByMajority20,
            axelrod.GTFT,
            axelrod.Grudger,
            axelrod.Inverse,
            axelrod.Random,
        ]

        for strategy in known_cheaters:
            self.assertFalse(axelrod.is_basic(strategy()), msg=strategy)

        for strategy in known_basic:
            self.assertTrue(axelrod.is_basic(strategy()), msg=strategy)

        for strategy in known_ordinary:
            self.assertFalse(axelrod.is_basic(strategy()), msg=strategy)