python_data_scien/poc2/poc2_mini_proj_1.py
def move_zombies(self, human_distance_field):
        """
        Function that moves zombies towards humans, no diagonal moves
        are allowed
        """
        for idx in range(len(self._zombie_list)):
            i_duple = self._zombie_list[idx]
            min_dis = i_duple
            neighbor_cell_list = poc_grid.Grid.four_neighbors(self,i_duple[0], i_duple[1])
            for neighbor_cell in neighbor_cell_list:
                if human_distance_field[neighbor_cell[0]][neighbor_cell[1]] < human_distance_field[min_dis[0]][min_dis[1]]:
                    min_dis = neighbor_cell
            min_dis_list = []
            cell_list = list(neighbor_cell_list)
            cell_list.append(i_duple)
            for k_item in cell_list:
                if human_distance_field[k_item[0]][k_item[1]] == human_distance_field[min_dis[0]][min_dis[1]]:
                    min_dis_list.append((k_item[0],k_item[1]))
            self._zombie_list[idx] = random.choice(min_dis_list)

        Function that moves zombies towards humans, no diagonal moves
        are allowed
        
Function that moves zombies towards humans, no diagonal moves
are allowed
Function that moves zombies towards humans no diagonal moves are allowed
def move_zombies(self, human_distance_field):
        for idx in range(len(self._zombie_list)):
            i_duple = self._zombie_list[idx]
            min_dis = i_duple
            neighbor_cell_list = poc_grid.Grid.four_neighbors(self,i_duple[0], i_duple[1])
            for neighbor_cell in neighbor_cell_list:
                if human_distance_field[neighbor_cell[0]][neighbor_cell[1]] < human_distance_field[min_dis[0]][min_dis[1]]:
                    min_dis = neighbor_cell
            min_dis_list = []
            cell_list = list(neighbor_cell_list)
            cell_list.append(i_duple)
            for k_item in cell_list:
                if human_distance_field[k_item[0]][k_item[1]] == human_distance_field[min_dis[0]][min_dis[1]]:
                    min_dis_list.append((k_item[0],k_item[1]))
            self._zombie_list[idx] = random.choice(min_dis_list)
def move_zombies ( self , human_distance_field ) : for idx in range ( len ( self . _zombie_list ) ) : i_duple = self . _zombie_list [ idx ] min_dis = i_duple neighbor_cell_list = poc_grid . Grid . four_neighbors ( self , i_duple [ 0 ] , i_duple [ 1 ] ) for neighbor_cell in neighbor_cell_list : if human_distance_field [ neighbor_cell [ 0 ] ] [ neighbor_cell [ 1 ] ] < human_distance_field [ min_dis [ 0 ] ] [ min_dis [ 1 ] ] : min_dis = neighbor_cell min_dis_list = [ ] cell_list = list ( neighbor_cell_list ) cell_list . append ( i_duple ) for k_item in cell_list : if human_distance_field [ k_item [ 0 ] ] [ k_item [ 1 ] ] == human_distance_field [ min_dis [ 0 ] ] [ min_dis [ 1 ] ] : min_dis_list . append ( ( k_item [ 0 ] , k_item [ 1 ] ) ) self . _zombie_list [ idx ] = random . choice ( min_dis_list )
Function that moves zombies towards humans, no diagonal moves
are allowed
Function that moves zombies towards humans no diagonal moves are allowed
"""
        Function that moves zombies towards humans, no diagonal moves
        are allowed
        """
self
human_distance_field