<commit_before>import sys, pygame,random
from pygame import Rect
from assets import Player
from assets import Platform
from assets import Camera
from assets import Wall
from assets import Goal

pygame.init()

size = width, height = 800, 600

def camera_update(camera, target_rect):
	l, t, _, _ = target_rect
	_, _, w, h = camera
	return Rect(-l , -t, w, h)

def createPlatforms():
	assetList = []
	
	#add first platform
	previousPlatform = firstPlatform = Platform(0, 300)
	assetList.append(firstPlatform)
	
	for i in range (0, 30):
		startingPoint = previousPlatform.rect.top
		heightDifference = random.randint(-50,50) + startingPoint
		if (heightDifference < 400):
			heightDifference = 400
		platform = Platform(i * 100, heightDifference)
		assetList.append(platform)
		previousPlatform = platform
	return assetList

def main():
	black = 0, 0, 0
	screen = pygame.display.set_mode(size)

	# create assets and add to asset list
	assetList = createPlatforms()
	platformSprites = pygame.sprite.RenderPlain(assetList)
	lastPlatform = assetList[-1]
	
	goal = Goal(lastPlatform.rect.centerx, lastPlatform.rect.centery-30)
	assetList.append(goal)
	
	player = Player(100, 250)
	assetList.append(player)
	
	wall = Wall()
	assetList.append(wall)<commit_msg>Tidied up greed's random platform generation<commit_after>import sys, pygame, random
from pygame import Rect
from assets import Player
from assets import Platform
from assets import Camera
from assets import Wall
from assets import Goal

pygame.init()

size = width, height = 800, 600

def camera_update(camera, target_rect):
	l, t, _, _ = target_rect
	_, _, w, h = camera
	return Rect(-l , -t, w, h)

def createPlatforms():
	assetList = []
	
	# add first platform
	previousPlatform = firstPlatform = Platform(0, 300)
	assetList.append(firstPlatform)
	
	for i in range (0, 30):
		heightDifference = random.randint(-40, 40) + previousPlatform.rect.bottom

		# keep the heights of the platform in a reasonable range
		if (heightDifference > 500):
			heightDifference = 400
		elif (heightDifference < 200):
			heightDifference = 200
			
		platform = Platform(i * 100, heightDifference)
		assetList.append(platform)
		
		#keep the current platform for the next iteration
		previousPlatform = platform
	return assetList

def main():
	black = 0, 0, 0
	screen = pygame.display.set_mode(size)

	# create assets and add to asset list
	assetList = createPlatforms()
	lastPlatform = assetList[-1] # grab last platform for the goal
	platformSprites = pygame.sprite.RenderPlain(assetList)
	
	goal = Goal(lastPlatform.rect.centerx, lastPlatform.rect.centery - 30)
	assetList.append(goal)
	
	player = Player(100, 250)
	assetList.append(player)
	
	wall = Wall()
	assetList.append(wall)
{'fraction_non_alphanumeric': 0.09341669731518941, 'fraction_numerical': 0.03015814637734461, 'mean_word_length': 4.528455284552845, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '5019951', 'n_tokens_mistral': 963, 'n_tokens_neox': 833, 'n_words': 264}