예제 #1
0
파일: window.py 프로젝트: MrShark/unqlocked
	def drawBackground(self):
		for row in range(self.config.layout.height):
			for col in range(self.config.layout.width):
				index = row * self.config.layout.width + col
				WINDOW_HOME.setProperty(PROPERTY_INACTIVE % index, self.config.layout.matrix[row][col])
		# Start with a state of uniform False
		self.state = createTruthMatrix(self.config.layout.height, self.config.layout.width)
예제 #2
0
파일: window.py 프로젝트: camochu/unqlocked
 def drawBackground(self):
     for row in range(self.config.layout.height):
         for col in range(self.config.layout.width):
             index = row * self.config.layout.width + col
             WINDOW_HOME.setProperty(PROPERTY_INACTIVE % index,
                                     self.config.layout.matrix[row][col])
     # Start with a state of uniform False
     self.state = createTruthMatrix(self.config.layout.height,
                                    self.config.layout.width)
예제 #3
0
	def step(self, time):
		# Ask the solver for the time
		log('Solving for the current time (%s)' % str(time))
		solution = self.solver.resolveTime(time)
		solutionUTF8 = [uni.encode('utf-8') for uni in solution]
		log('Solution: ' + str(solutionUTF8))
		
		truthMatrix = createTruthMatrix(self.layout.height, self.layout.width)
		success = self.highlight(self.layout.matrix, truthMatrix, solution)
		if not success:
			log('Unable to highlight solution. Reattempting with no spaces between words')
			truthMatrix = createTruthMatrix(self.layout.height, self.layout.width)
			success = self.highlight(self.layout.matrix, truthMatrix, solution, False)
			if success:
				log('Success')
			else:
				log('Failed to highlight solution again. Drawing best attempt')
		
		# Draw the result
		self.window.drawMatrix(truthMatrix)
예제 #4
0
	def cleanup(self):
		'''Clear window properties'''
		truthMatrix = createTruthMatrix(self.layout.height, self.layout.width)
		self.window.drawMatrix(truthMatrix)
		pass