<commit_before>#Imports
import pygame
from pygame.locals import *

from OpenGL.GL import *
from OpenGL.GLU import *

from shapes import Shape, Cube

#Create a game class
class Game(object):
	
	#Constructor
	def __init__(self, title, width, height, bgcolour):
		
		#Initialise pygame
		pygame.init()

		#Set the size of the window
		self.size = self.width, self.height = width, height
		
		#Set the default perspective and clipping distances
		self.fov = 45.0
		self.aspectratio = width / height
		self.minrender = 0.1
		self.maxrender = 80
		
		#Set the pygame mode to use double buffering and open gl
		pygame.set_mode(self.size, DOUBLEBUF|OPENGL)
		
		#Set the perspective
		self.setperspective()
		
		#Create an empty list of shapes to render
		self.shapes = []
		
	#Create a function to update the perspective
	def setperspective(self):
		
		#Set the perspective
		gluPerspective(self.fov, self.aspectratio, self.minrender, self.maxrender)
		
	#Create a function to add a shape
	def addshape(self, s):
		self.shapes.append(s)
		
	#Create a function to render the shapes
	def render(self):
		#For each of the shapes, check the type and render it
		for s in shapes:
			#If the shape is a cube, call the rendercube method
			if s.type == Shape.CUBE:
				rendercube(s)
	<commit_msg>Add a function to render a Cube.<commit_after>#Imports
import pygame
from pygame.locals import *

from OpenGL.GL import *
from OpenGL.GLU import *

from shapes import Shape, Cube

#Create a game class
class Game(object):
	
	#Constructor
	def __init__(self, title, width, height, bgcolour):
		
		#Initialise pygame
		pygame.init()
		
		#Set the window caption
		pygame.display.set_caption(title)

		#Set the size of the window
		self.size = self.width, self.height = width, height
		
		#Set the default perspective and clipping distances
		self.fov = 45.0
		self.aspectratio = width / height
		self.minrender = 0.1
		self.maxrender = 80
		
		#Set the pygame mode to use double buffering and open gl
		pygame.set_mode(self.size, DOUBLEBUF|OPENGL)
		
		#Set the perspective
		self.setperspective()
		
		#Create an empty list of shapes to render
		self.shapes = []
		
	#Create a function to update the perspective
	def setperspective(self):
		
		#Set the perspective
		gluPerspective(self.fov, self.aspectratio, self.minrender, self.maxrender)
		
	#Create a function to add a shape
	def addshape(self, s):
		self.shapes.append(s)
		
	#Create a function to render the shapes
	def render(self):
		#For each of the shapes, check the type and render it
		for s in shapes:
			#If the shape is a cube, call the rendercube method
			if s.type == Shape.CUBE:
				rendercube(s)
				
	#Create a function to render a cube
	def rendercube(self, cube):
	
		#Start the gl drawing specifying a type of lines
		glBegin(GL_QUADS)
		
		#Set the colour
		glColor3fv((1, 0, 1))
		
		#For each of the surfaces
		for surface in cube.surfaces:
			#For each of the vertices in the surface
			for vertex in surface:
				#Draw the vertex
				glVertex3fv(cube.vertices[vertex])
				
		#End the gl drawinf
		glEnd()
		
		#Start the gl drawing specifying a type of lines
		glBegin(GL_LINES)
		
		#Set the colour
		glColor3fv((1, 1, 1))
		
		#For each of the edges
		for edge in cube.edges:
			#For each of the vertices in the edge
			for vertex in edge:
				#Draw the vertex
				glVertex3fv(cube.vertices[vertex])
				
		#End the gl drawing
		glEnd()
{'fraction_non_alphanumeric': 0.07737569873492203, 'fraction_numerical': 0.00706090026478376, 'mean_word_length': 3.336734693877551, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1100152', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1086, 'n_words': 415}