<commit_before>import pygame
from random import randint

# List of the [x, y] coordinates of existing holes
hole_locations = []


class Hole(pygame.sprite.Sprite):
    """
    Holes: The ants portal to the underworld
    """
    def __init__(self):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.image.load("images/hole01a.png").convert_alpha()
        self.rect = self.image.get_rect()
        if len(hole_locations) > 60:
            raise ValueError("Exceeded maximum number of holes: 60")
        self.rect.x, self.rect.y = get_valid_hole_location()


def get_valid_hole_location():
    """
    Run through hole_locations in search for new a new valid hole location
    :return: The valid x and y coordinates
    """
    valid_location = False  # First assume the location is not valid
    global hole_locations
    x = 0
    y = 0

    while not valid_location:  # Loop while coordinates not valid
        # Count to check the new hole is valid for all existing holes
        valid_count = 0
        x = randint(1, 838)  # Generate random x
        y = randint(1, 538)  # And random y
        for hole_loc in hole_locations:  # For each hole
            # If new hole is to the left of, or above the existing hole
            if x < hole_loc[0] - 61 or y < hole_loc[1] - 61:
                valid_count += 1
            # Else if new hole doesn't overlap existing hole
            elif not (x < hole_loc[0] + 61 and y < hole_loc[1] + 61):
                valid_count += 1
        # If coordinates are valid for every existing hole
        if valid_count == len(hole_locations):
            valid_location = True

    hole_locations.append([x, y])  # Add new coordinates to list
    return x, y  # Return coordinates x and y<commit_msg>Update hole_class.py<commit_after>import pygame
from random import randint

# List of the [x, y] coordinates of existing holes
hole_locations = []


class Hole(pygame.sprite.Sprite):
    """
    Holes: The ants portal to the underworld
    """
    def __init__(self):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.image.load("images/hole01a.png").convert_alpha()
        self.rect = self.image.get_rect()
        if len(hole_locations) > 60:
            raise ValueError("Exceeded maximum number of holes: 60")
        self.rect.x, self.rect.y = get_valid_hole_location()


def get_valid_hole_location():
    """
    Run through hole_locations in search for a new valid hole location
    :return: The valid x and y coordinates
    """
    valid_location = False  # First assume the location is not valid
    global hole_locations
    x = 0
    y = 0

    while not valid_location:  # Loop while coordinates not valid
        # Count to check the new hole is valid for all existing holes
        valid_count = 0
        x = randint(1, 838)  # Generate random x
        y = randint(1, 538)  # And random y
        for hole_loc in hole_locations:  # For each hole
            # If new hole is to the left of, or above the existing hole
            if x < hole_loc[0] - 61 or y < hole_loc[1] - 61:
                valid_count += 1
            # Else if new hole doesn't overlap existing hole
            elif not (x < hole_loc[0] + 61 and y < hole_loc[1] + 61):
                valid_count += 1
        # If coordinates are valid for every existing hole
        if valid_count == len(hole_locations):
            valid_location = True

    hole_locations.append([x, y])  # Add new coordinates to list
    return x, y  # Return coordinates x and y
{'fraction_non_alphanumeric': 0.08010189640532125, 'fraction_numerical': 0.0175488253608831, 'mean_word_length': 2.3529411764705883, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '485866', 'n_tokens_mistral': 1085, 'n_tokens_neox': 1006, 'n_words': 383}