Exemple #1
0
	def info(self):

		while True:
			functions.clear_screen()
			functions.pyramid_logo()
			functions.greeting()
			selection_menu = functions.list_items(self.description,self.menu)
			
			answer = functions.prompt()
			
			if answer in selection_menu:
				selection_menu.get(answer).info()
			#check answer against the exit tuple and runs a shutdown sequence if true.
			if answer in functions.exit_tuple:
				functions.countdown("\nSHUTTING DOWN APPLICATION.\n","",4)
				sys.exit("\nUSER TERMINATED APPLICATION.\n")
			#checks answer for reboot sequence. 
			if answer == "reboot":
				functions.countdown("USER INITIALIZED REBOOT","REBOOTING",4)
				functions.greeting(.09)
			if answer == "return":
				break
			
			else:
				print("response invalid.")
				continue
def main():
    countdown(4)
    PAUSED = False
    training_data = []
    while True:
        if not PAUSED:
            start_time = time.time()
            screen = get_screen()
            #show_screen(screen)

            keys = key_check()
            output = keys_to_output(keys)
            training_data.append([screen, output])
            length = len(training_data)

            if length == 1000:
                save(length, training_data)
                training_data = []
            print(
                "Not Paused Loop took: {}{:.3f}{} seconds || training_data length: {}"
                .format('{',
                        time.time() - start_time, '}', length))

        keys = key_check()

        if P in keys:
            if not PAUSED:
                PAUSED = True
                print("Paused training")
                time.sleep(3)
            else:
                PAUSED = False
                print("Unpausing training")
Exemple #3
0
def verify_user(message):
    chat_id = message.chat.id
    user_id = message.from_user.id
    print(message.from_user.username + " entered " + message.chat.title)
    captcha = types.InlineKeyboardButton("I'm not a robot", callback_data="ok")
    markup = types.InlineKeyboardMarkup()
    markup.add(captcha)
    captcha_message = bot.send_message(chat_id,
                                       "@" + message.from_user.username +
                                       " verify you're not a robot",
                                       reply_markup=markup)
    message_id = captcha_message.message_id
    functions.stop_countdown = False
    if (functions.countdown(wait_time) == True):
        bot.delete_message(chat_id, message_id)
        if (bot.get_chat_member(chat_id, user_id).status != "creator"
                and bot.get_chat_member(chat_id,
                                        user_id).status != "administrator"):
            print(message.from_user.username + " who entered in " +
                  message.chat.title +
                  " didn't answered the captcha and was kicked.")
            bot.kick_chat_member(chat_id, user_id)
        else:
            print(message.from_user.username + " who entered in " +
                  message.chat.title +
                  " didn't answered the captcha but it's an admin.")
Exemple #4
0
	def info(self):
		while True:
			"""method to print info about the region."""
			functions.clear_screen()
			functions.pyramid_logo()
			#prints information from object. 
			print(
				"=" * 80
				+"\nGalactic power: \n"
				+ self.title
				+ "\n" + "=" * 80
				+"\n\n SYNOPSIS: \n\n"
				+ self.synopsis 
				+ "\n\n HISTORY: \n\n"
				+ self.history 
				+"\n\n"
				)
			if self.sectors:
				selection_menu = functions.list_items(str(self.name + " sectors"),self.sectors.items())
				answer = input("Select Index number for more information: ")
				if answer in selection_menu:
					selection_menu.get(answer).info()
					
				elif answer in functions.exit_tuple:
					functions.countdown("\nSHUTTING DOWN APPLICATION.\n","",4)
					sys.exit("\nUSER TERMINATED APPLICATION.\n")
				#checks answer for reboot sequence. 
				
				elif answer == "reboot":
					functions.countdown("USER INITIALIZED REBOOT","REBOOTING",4)
					functions.greeting(.09)
				else:
					return answer
			else:
				print("=" * 80 + "\n" + "This OBJECT contain \"NULL VALUE\"" + "\n" + "=" * 80 + "\n")
				answer = input("enter RETURN to go back: ")
								
				if answer in functions.exit_tuple:
					functions.countdown("\nSHUTTING DOWN APPLICATION.\n","",4)
					sys.exit("\nUSER TERMINATED APPLICATION.\n")
				#checks answer for reboot sequence. 
				
				elif answer == "reboot":
					functions.countdown("USER INITIALIZED REBOOT","REBOOTING",4)
					functions.greeting(.09)
				else:
					return answer
from functions import computer, check_input, user, countdown, winner

# Get user action
user_action = check_input(user())

# Initiate countdown
countdown()

# Get winner/draw
winner(user_action, computer())
Exemple #6
0
import functions as f

k=0
totalup=0.
totaldown=0.
#ranging through odd integers
for i in range(1,500000000):
    k+=1
    m=2*i-1
    sizen = f.count(m)
    j=3*m+1
    sizeup = f.count(j)
    sizedown = f.countdown(j)
    totalup+=(sizeup-sizen)
    totaldown+=sizedown
print(m)
print("Total up: ") #average binary digits up
print(totalup/k)
print("\nTotal down: ") #average binary digits down
print(totaldown/k)
print("\nTotal net: ") #average net change
print((totalup-totaldown)/k)
Exemple #7
0
	def info(self,line_cap = 82):
		"""method to print statistics on planet."""
		name = str(" Name: " + self.name)
		region = str(" Region: " + self.region + " ")
		s_hex = str(" System Hex: " + self.s_hex + " ")
		atmo = str(" Atmosphere: " + self.atmo + " ")
		temp = str(" Temperature: " + self.temp + " ")
		biosphere = str(" Biosphere: " + self.biosphere + " ")
		population = str(" Population: " + self.population + " ")
		tech_level = str(" Tech Level: " + self.tech_level + " ")
		title_bar = ("=" * line_cap)
		while True:
			functions.clear_screen()
			functions.pyramid_logo()
			#creates title bar
			print(title_bar)
			print(name + " " * (line_cap - (len(name) + len(region))) + region) 
			print(title_bar + "\n")
		
		
			#format information for atmo and system Hex.
		
			print(
				" " 
				+ "*" * (len(atmo) + 2) 
				+ " " * (line_cap - (len(atmo) + len(s_hex) + 3)) 
				+ "*" * (len(s_hex) + 2)
				)
			
			print(
				" *" 
				+ atmo
				+ "*" 
				+ " " * (line_cap - (len(atmo) + 3
				+ len(s_hex))) 
				+ "*" 
				+ s_hex
				+ "*"
				)
				
		
			print(
				" "
				+ "*" * (len(atmo) + 2)
				+ " " * (line_cap - (len(atmo) + len(s_hex) + 3))
				+ "*" * (len(s_hex) + 2)
				)
		
			print("\n")
		
			#formats Temperature and Biosphere information.
			
			print(" " + "*" * (len(temp) + 2)
			+ " " * (line_cap - (len(temp) + len(biosphere) + 3))
			+ "*" * (len(biosphere) + 2)
			)
		
			print(
				" *" 
				+ temp 
				+ "*" 
				+ " " * (line_cap - (len(temp) + 3 + len(biosphere))) 
				+ "*" 
				+ biosphere
				+ "*"
				)
			
			print(
				" "
				+ "*" * (len(temp) + 2)
				+ " " * (line_cap - (len(temp) + len(biosphere) + 3))
				+ "*" * (len(biosphere) + 2)
				)
					
			print("\n")	
		
			#format populaiton and Tech_level
			print(
				" " 
				+ "*" * (len(population) + 2) 
				+ " " * (line_cap - (len(population) + len(tech_level) + 3)) 
				+ "*" * (len(tech_level) + 2)
				)
		
			print(
				" *" 
				+ population
				+ "*" 
				+ " " * (line_cap - (len(population) + 3 + len(tech_level))) 
				+ "*" 
				+ tech_level
				+ "*"
				)
			
		
			print(
				" "
				+ "*" * (len(population) + 2)
				+ " " * (line_cap - (len(population) + len(tech_level) + 3))
				+ "*" * (len(tech_level) + 2)
				)
			
			print("\n") 
			
			print(
				"=" * line_cap 
				+ "\n" 
				+ "Enter Overview for more detailed information if available.\nEnter More for a list of available resources."
				+ "\n"
				+ "=" * line_cap
				)
			
			answer = functions.prompt("\n: ")
				
			#check answer against the exit tuple and runs a shutdown sequence if true.
			if answer in functions.exit_tuple:
				functions.countdown("\nSHUTTING DOWN APPLICATION.\n","",4)
				sys.exit("\nUSER TERMINATED APPLICATION.\n")
			#checks answer for reboot sequence. 
			if answer == "reboot":
				functions.countdown("USER INITIALIZED REBOOT","REBOOTING",4)
				functions.greeting(.09)
			if answer == "overview":
				self.print_overview()
			if answer == "more":
				self.print_more()
			if answer == "return":
				break
				
			else:
				print("response invalid.")
				continue
    
    

    
    
#end of system class
    All of the code lives in funcitions.py and is called from app.py.

    This was done as a way to practice importing libraries and passing in variable values.
"""

# Clears the console
functions.clear()

# Gets tags for reading
tags = functions.tags()

# Gathers first blood pressure reading
bp1 = functions.reading("first")

# Delays 30 seconds
functions.countdown()

# Gathers second blood pressure reading
bp2 = functions.reading("second")

# Delays 30 seconds
functions.countdown()

# Gathers third blood pressure reading
bp3 = functions.reading("third")

# Averages the 3 blood pressure reading
avg_bp = functions.avgbp(bp1, bp2, bp3)

# returns diagnoses from the calculated average blood pressure
diagnosis = functions.diagnosis_output(avg_bp)