Beispiel #1
0
def step(direction, key_pressed, direction_string):
	
	if MRI_ON:
		while not (time.mri_increment() and time.num_chars >= TIME_DECIDE/MRI_TIME):
			PyGameFuncs.event_loop()
			refresh_focus() #so this displays screen for MIN of time decide, and then moves on at hte next 5 keypress??
	else:
		time.mri_delay(TIME_DECIDE) #############Displays for n secs after decision???
		
	time.reset()	#Start from 0
	
	display_selected(direction_string)##maybe move this???
	time.mri_delay(CHOICE_DELAY)#?
	#time.reset()#?
		
	writefile.add_output_buffer_prelim(subject_num)	#Write to file with preliminary info. 
	current_inventory = inventory.inventory
	
	maze.step(direction)	#Move
	maze.increment_step_count()
	#display()	#Just in case, refresh
		
	decrement_amounts = inventory.decrement()
	
	PyGameFuncs.wait_key_up(key_pressed)	#Present message about prize, wait for key release 
	#########not sure why this is here. ie about timing and stuff (go test if it works ok later)
	writefile.add_output_buffer_postlim(direction_string, current_inventory, decrement_amounts)	#Add more to output
	writefile.flush_output(subject_num)	#Output to file
	
		#Display 
	#pygame.display.flip()
	
	three_hallways_step()
	#print 'depth ' + str(maze.position.depth)
	display()
Beispiel #2
0
def step(direction, key_pressed, direction_string):
	while not (time.mri_increment() and time.num_chars >= TIME_DECIDE/MRI_TIME):
		PyGameFuncs.event_loop()
		refresh_focus()
	time.reset()	#Start from 0
			
	writefile.add_output_buffer_prelim()	#Write to file with preliminary info. 
	current_inventory = inventory.inventory
	
	maze.step(direction)	#Move
	maze.increment_step_count()
		
	decrement_amounts = inventory.decrement()
	
	output2d.draw_selected()
	time.mri_delay(CHOICE_DELAY)
	time.reset()
	
	PyGameFuncs.wait_key_up(key_pressed)	#Present message about prize, wait for key release
	writefile.add_output_buffer_postlim(direction_string, current_inventory, decrement_amounts)	#Add more to output
	writefile.flush_output()	#Output to file
		#Display 
	#pygame.display.flip()
	
	three_hallways_step()
	print 'depth ' + str(maze.position.depth)
	display()
Beispiel #3
0
	def mri_delay(self, time): #input how long of a delay you want
		if MRI_ON:
			while self.num_chars < time/MRI_TIME:
				PyGameFuncs.event_loop()
				self.mri_increment()
		else:
			print "got till here"
			pygame.time.delay(time*1000)
Beispiel #4
0
def run():	
	while True:
		PyGameFuncs.event_loop()
		
		time.mri_increment()
				
		if pygame.key.get_pressed()[pygame.K_UP]:
			if hallway_type not in [Hallways.LEFT, Hallways.RIGHT, Hallways.BIFURC]:
				step(Directions.FORWARDS, pygame.K_UP, "centre")

		elif BACKWARDS_MOVE and pygame.key.get_pressed()[pygame.K_DOWN] and maze.position.adjacent[Directions.BACKWARDS] != None:
			step(Directions.BACKWARDS, pygame.K_DOWN, "back")
			
		elif pygame.key.get_pressed()[pygame.K_LEFT]:
			if hallway_type not in [Hallways.STRAIGHT, Hallways.RIGHT, Hallways.RIGHT_BIFURC]:
				step(Directions.LEFT, pygame.K_LEFT, "left")
				
		elif pygame.key.get_pressed()[pygame.K_RIGHT]:
			if hallway_type not in [Hallways.STRAIGHT, Hallways.LEFT, Hallways.LEFT_BIFURC]:
				step(Directions.RIGHT, pygame.K_RIGHT, "right")
				
		refresh_focus()
		
		hallway_type = maze.current_type()
Beispiel #5
0
	def mri_increment(self):
		if pygame.key.get_pressed()[MRI_CHAR]:
			self.num_chars += 1
			PyGameFuncs.wait_key_up(MRI_CHAR)
			return True
		return False
Beispiel #6
0
	def mri_delay(self, time):
		while self.num_chars < time/MRI_TIME:
			PyGameFuncs.event_loop()
			self.mri_increment()