Beispiel #1
0
    def test_add_parent_single_parent(self):
        """
        Test add_parent method in case of asexual reproduction (one parent)
        """

        player = Player(i=10, log_dir=".", tob=10, energy=200)
        player.add_parent(id=1, tob=0)
        self.assertEqual(player.action_history[1][0], 1)
        self.assertEqual(player.action_history[1][1], 0)
Beispiel #2
0
    def test_add_parent_two_parents(self):
        """
        Test add_parent method in case of sexual reproduction (two parents)
        """

        player = Player(i=10, log_dir=".", tob=10, energy=200)
        player.add_parent(id=1, tob=0, mate_id=2, mate_tob=3)
        self.assertEqual(player.action_history[1][0][0], 1)
        self.assertEqual(player.action_history[1][0][1], 0)
        self.assertEqual(player.action_history[1][1][0], 2)
        self.assertEqual(player.action_history[1][1][1], 3)