games.py
def handle_collision(self, player1: str, player2: str) -> None:
        """ Perform some action when <player1> and <player2> collide.

        Both players should reverse the direction they are moving in.
        if one player is a zombie and the other is a human, the human
        becomes a zombie.

        === Precondition ===
        - player1 and player2 are in either self._humans or self._zombies

        >>> zombie_tag = ZombieTag(4, QuadTree((250, 250)), 5, 8, 6)
        >>> zombie_tag.handle_collision('p0', 'p1')
        >>> len(zombie_tag.__getattribute__('_zombies')) == 2
        True
        >>> len(zombie_tag.__getattribute__('_humans')) == 3
        True
        """
        if player1 in self._zombies and player2 in self._humans:
            p1, p2 = self._zombies[player1], self._humans[player2]
            p1.reverse_direction()
            p2.reverse_direction()
            p2.set_colour('purple')
            p2.set_speed(1)
            for zombie in self._zombies:
                p2.ignore_enemy(zombie)
                self._zombies[zombie].ignore_target(player2)
            self._zombies[player2] = p2
            del self._humans[player2]
            for human in self._humans:
                self._humans[human].select_enemy(player2)
                p2.select_target(human)
        elif player2 in self._zombies and player1 in self._humans:
            p1, p2 = self._humans[player1], self._zombies[player2]
            p2.reverse_direction()
            p1.reverse_direction()
            p1.set_colour('purple')
            p1.set_speed(1)
            for zombie in self._zombies:
                p1.ignore_enemy(zombie)
                self._zombies[zombie].ignore_target(player1)
            self._zombies[player1] = p1
            del self._humans[player1]
            for human in self._humans:
                self._humans[human].select_enemy(player1)
                p1.select_target(human)
        elif player1 in self._zombies and player2 in self._zombies:
            self._zombies[player1].reverse_direction()
            self._zombies[player2].reverse_direction()
        else:
            self._humans[player1].reverse_direction()
            self._humans[player2].reverse_direction()
 Perform some action when <player1> and <player2> collide.

        Both players should reverse the direction they are moving in.
        if one player is a zombie and the other is a human, the human
        becomes a zombie.

        === Precondition ===
        - player1 and player2 are in either self._humans or self._zombies

        >>> zombie_tag = ZombieTag(4, QuadTree((250, 250)), 5, 8, 6)
        >>> zombie_tag.handle_collision('p0', 'p1')
        >>> len(zombie_tag.__getattribute__('_zombies')) == 2
        True
        >>> len(zombie_tag.__getattribute__('_humans')) == 3
        True
        
Perform some action when  and  collide.
Both players should reverse the direction they are moving in.
if one player is a zombie and the other is a human, the human
becomes a zombie.

Precondition
player1 and player2 are in either self._humans or self._zombies


Perform some action when and collide . Both players should reverse the direction they are moving in . if one player is a zombie and the other is a human the human becomes a zombie . Precondition player1 and player2 are in either self . _humans or self . _zombies
def handle_collision(self, player1: str, player2: str) -> None:
        if player1 in self._zombies and player2 in self._humans:
            p1, p2 = self._zombies[player1], self._humans[player2]
            p1.reverse_direction()
            p2.reverse_direction()
            p2.set_colour('purple')
            p2.set_speed(1)
            for zombie in self._zombies:
                p2.ignore_enemy(zombie)
                self._zombies[zombie].ignore_target(player2)
            self._zombies[player2] = p2
            del self._humans[player2]
            for human in self._humans:
                self._humans[human].select_enemy(player2)
                p2.select_target(human)
        elif player2 in self._zombies and player1 in self._humans:
            p1, p2 = self._humans[player1], self._zombies[player2]
            p2.reverse_direction()
            p1.reverse_direction()
            p1.set_colour('purple')
            p1.set_speed(1)
            for zombie in self._zombies:
                p1.ignore_enemy(zombie)
                self._zombies[zombie].ignore_target(player1)
            self._zombies[player1] = p1
            del self._humans[player1]
            for human in self._humans:
                self._humans[human].select_enemy(player1)
                p1.select_target(human)
        elif player1 in self._zombies and player2 in self._zombies:
            self._zombies[player1].reverse_direction()
            self._zombies[player2].reverse_direction()
        else:
            self._humans[player1].reverse_direction()
            self._humans[player2].reverse_direction()
def handle_collision ( self , player1 : str , player2 : str ) -> None : if player1 in self . _zombies and player2 in self . _humans : p1 , p2 = self . _zombies [ player1 ] , self . _humans [ player2 ] p1 . reverse_direction ( ) p2 . reverse_direction ( ) p2 . set_colour ( 'purple' ) p2 . set_speed ( 1 ) for zombie in self . _zombies : p2 . ignore_enemy ( zombie ) self . _zombies [ zombie ] . ignore_target ( player2 ) self . _zombies [ player2 ] = p2 del self . _humans [ player2 ] for human in self . _humans : self . _humans [ human ] . select_enemy ( player2 ) p2 . select_target ( human ) elif player2 in self . _zombies and player1 in self . _humans : p1 , p2 = self . _humans [ player1 ] , self . _zombies [ player2 ] p2 . reverse_direction ( ) p1 . reverse_direction ( ) p1 . set_colour ( 'purple' ) p1 . set_speed ( 1 ) for zombie in self . _zombies : p1 . ignore_enemy ( zombie ) self . _zombies [ zombie ] . ignore_target ( player1 ) self . _zombies [ player1 ] = p1 del self . _humans [ player1 ] for human in self . _humans : self . _humans [ human ] . select_enemy ( player1 ) p1 . select_target ( human ) elif player1 in self . _zombies and player2 in self . _zombies : self . _zombies [ player1 ] . reverse_direction ( ) self . _zombies [ player2 ] . reverse_direction ( ) else : self . _humans [ player1 ] . reverse_direction ( ) self . _humans [ player2 ] . reverse_direction ( )
Perform some action when <player1> and <player2> collide.
Perform some action when <player1 > and <player2 > collide .
""" Perform some action when <player1> and <player2> collide.

        Both players should reverse the direction they are moving in.
        if one player is a zombie and the other is a human, the human
        becomes a zombie.

        === Precondition ===
        - player1 and player2 are in either self._humans or self._zombies

        >>> zombie_tag = ZombieTag(4, QuadTree((250, 250)), 5, 8, 6)
        >>> zombie_tag.handle_collision('p0', 'p1')
        >>> len(zombie_tag.__getattribute__('_zombies')) == 2
        True
        >>> len(zombie_tag.__getattribute__('_humans')) == 3
        True
        """
self
player1
str
player2
str