import random

class GameGenerator:
def __init__(self):
self.width = 100
self.height = 15
self.objects = []

def generate(self):

for i in range(self.width):
ground.append(random.choice(['grass', 'dirt', 'rock']))
self.objects.append({'type': 'ground', 'position': (0, self.height - 1), 'width': self.width, 'height': 1, 'texture': ground})

num_blocks = random.randint(5, 15)
for i in range(num_blocks):
x = random.randint(1, self.width-2)
y = random.randint(1, self.height-5)
block_type = random.choice(['brick', 'question'])
self.objects.append({'type': block_type, 'position': (x, y), 'width': 1, 'height': 1})
num_pipes = random.randint(1, 3)
for i in range(num_pipes):
x = random.randint(1, self.width-6)
y = self.height - 2
self.objects.append({'type': 'pipe', 'position': (x, y), 'width': 2, 'height': 2})

num_enemies = random.randint(1, 5)
for i in range(num_enemies):
x = random.randint(1, self.width-2)
y = random.randint(1, self.height-3)
enemy_type = random.choice(['goomba', 'koopa'])
self.objects.append({'type': enemy_type, 'position': (x, y), 'width': 1, 'height': 1})

flagpole_x = self.width - 2
flagpole_height = random.randint(3, 10)
self.objects.append({'type': 'flagpole', 'position': (flagpole_x, 0), 'width': 1, 'height': flagpole_height})

castle_x = self.width - random.randint(10, 20)
castle_height = random.randint(5, 10)
self.objects.append({'type': 'castle', 'position': (castle_x, 0), 'width': 5, 'height': castle_height})

return {'width': self.width, 'height': self.height, 'objects': self.objects}