window.update() sleep(l1lll11l_opy_) l1l1111_opy_ = l1l1111_opy_ + l1llll1_opy_ # l111l1l_opy_ l11l1l_opy_ l11l1l_opy_ = l11111l_opy_[7] # get l1llll1l_opy_ prompt = l1ll1l_opy_ (u"ࠨࡇࡑࡘࡊࡘࠠࡑࡃࡖࡗࡕࡒࡅࠢࡁࠫࡃ") # prompt for l1111l_opy_ l1111l_opy_ = window.input_string(prompt, l1lll1l_opy_, l1l1111_opy_) l1l1111_opy_ = l1l1111_opy_ + l1llll1_opy_ l111111_opy_ = l111111_opy_ - 1 while l1111l_opy_ != l11l1l_opy_ and l111111_opy_ > 0: window.draw_string(str(l111111_opy_), l1lll1l_opy_, l1llll1_opy_) if l111111_opy_ == 1: l111l11_opy_ = l1ll1l_opy_ (u"ࠩ࠭ࠦࡌࡐࡅࡎࡓ࡚࡚ࠠࡘࡃࡕࡒࡎࡔࡇࠡࠬ࠭ࠬࡄ") l111ll1_opy_ = window.get_width() - window.get_string_width(l111l11_opy_) l1lll1ll_opy_ = window.get_height() - l1llll1_opy_ window.draw_string(l111l11_opy_, l111ll1_opy_, l1lll1ll_opy_) l1111l_opy_ = window.input_string(prompt, l1lll1l_opy_, l1l1111_opy_) l1l1111_opy_ = l1l1111_opy_ + l1llll1_opy_ l111111_opy_ = l111111_opy_ - 1 # end l11l11_opy_ # clear window window.clear() # create l1l1lll_opy_ if l1111l_opy_ == l11l1l_opy_: l1l1lll_opy_ = [l1111l_opy_, l1ll1l_opy_ (u"ࠪࠫࡅ"), l1ll1l_opy_ (u"ࠫࡊ࡞ࡉࡕࡋࡑࡋࠥࡊࡅࡃࡗࡊࠤࡒࡕࡄࡆࠩࡆ"), l1ll1l_opy_ (u"ࠬ࠭ࡇ"), l1ll1l_opy_ (u"࠭ࡌࡐࡉࡌࡒ࡙ࠥࡕࡄࡅࡈࡗࡘࡌࡕࡍࠢ࠰ࠤࡋࡌࡄࡑࡐࡉࠥࡈࡁࡄࡍࠪࡈ"), l1ll1l_opy_ (u"ࠧࠨࡉ")] prompt = l1ll1l_opy_ (u"ࠨࡒࡕࡉࡘ࡙ࠠࡆࡐࡗࡉࡗࠦࡔࡐࠢࡆࡓࡓ࡚ࡉࡏࡗࡈࠫࡊ") else: l1l1lll_opy_ = [l1111l_opy_, l1ll1l_opy_ (u"ࠩࠪࡋ"), l1ll1l_opy_ (u"ࠪࡐࡔࡍࡉࡏࠢࡉࡅࡎࡒࡕࡓࡇࠣ࠱࡚ࠥࡅࡓࡏࡌࡒࡆࡒࠠࡍࡑࡆࡏࡊࡊࠧࡌ"), l1ll1l_opy_ (u"ࠫࠬࡍ"),l1ll1l_opy_ (u"ࠬࡖࡌࡆࡃࡖࡉࠥࡉࡏࡏࡖࡄࡇ࡙ࠦࡁࡏࠢࡄࡈࡒࡏࡎࡊࡕࡗࡖࡆ࡚ࡏࡓࠩࡎ"), l1ll1l_opy_ (u"࠭ࠧࡏ")] prompt = l1ll1l_opy_ (u"ࠧࡑࡔࡈࡗࡘࠦࡅࡏࡖࡈࡖ࡚ࠥࡏࠡࡇ࡛ࡍ࡙࠭ࡐ")
# check for condition if guess == "HUNTING": # create Success outcome_line_one = "EXITING DEBUG MODE" outcome_line_two = "LOGIN SUCCESSFUL - WELCOME BACK" prompt = "PRESS ENTER TO CONTINUE" else: # create Failure outcome_line_one = "LOGIN FAILURE - TERMINAL LOCKED" outcome_line_two = "PLEASE CONTACT AN ADMNISTRATOR" prompt = "PRESS ENTER TO EXIT" # Display Outcome # Display Guess x_space = window.get_width() - window.get_string_width(guess) line_x = x_space // 2 y_space = window.get_height() - 7 * string_height line_y = y_space // 2 window.draw_string(guess, line_x, line_y) time.sleep(1.5) window.update() height += string_height line_y += string_height # Display Blank line def cal_line_x(string, string_height): x_space = window.get_width() - window.get_string_width(string) line_x = x_space // 2
#create failure else: outcome_list = [ guess, 'LOGIN FAILURE - TERMINAL LOCKED', 'PLEASE CONTACT AN ADMINISTRATOR' ] prompt = 'PRESS ENTER TO EXIT' #display outcome outcome_height = 7 * text_height line_y = (window.get_height() - outcome_height) / 2 for outcome in outcome_list: line_x = (window.get_width() - window.get_string_width(outcome)) / 2 window.draw_string(outcome, line_x, line_y) window.update() sleep(sleep_time) line_y = line_y + 2 * text_height #prompt for end line_x = (window.get_width() - window.get_string_width(prompt)) / 2 window.input_string(prompt, line_x, line_y) #close window window.close()
# Use uagame module # Documentation for uagame is in file 'uagame_documentation.txt' from uagame import Window from time import sleep # create window window = Window("Hacking", 600, 500) window.set_font_name("couriernew") window.set_font_size(18) window.set_font_color("green") window.set_bg_color("black") # get window height and width window_height = window.get_height() window_width = window.get_width() # display header line_x = 0 line_y = 0 string_high = window.get_font_height() # for header line in header attempts = 4 header = ["DEBUG MODE", "%d ATTEMPT(S) LEFT" % attempts, ""] for header_line in header: window.draw_string(header_line, line_x, line_y) window.update() line_y += string_high sleep(0.3) # display password
outcome_line4 = 'PRESS ENTER TO CONTINUE' else: # create failure outcome_line2 = 'LOGIN FAILURE - TERMINAL LOCKED' outcome_line3 = 'PLEASE CONTACT AN ADMINISTRATOR' outcome_line4 = 'PRESS ENTER TO EXIT' # display outcome # compute initial y coordinate outcome_height = 7 * string_height y_space = window.get_height() - outcome_height line_y = y_space // 2 outcome_list = [guess, '', outcome_line2, '', outcome_line3, ''] for outcome_line in outcome_list: # display outcome x_space = window.get_width() - window.get_string_width(outcome_line) line_x = x_space // 2 window.draw_string(outcome_line, line_x, line_y) window.update() sleep(0.3) line_y = line_y + string_height x_space = window.get_width() - window.get_string_width(outcome_line4) line_x = x_space // 2 window.input_string(outcome_line4, line_x, line_y) # close window window.close()
l1l1111_opy_ = l1l1111_opy_ + l1llll1_opy_ # l1l_opy_ l1l111_opy_ line window.draw_string(l1ll1l_opy_(u"ࠫࠬࠣ"), 0, l1l1111_opy_) window.update() sleep(0.3) l1l1111_opy_ = l1l1111_opy_ + l1llll1_opy_ # prompt for l1111l_opy_ l1111l_opy_ = window.input_string(l1ll1l_opy_(u"ࠬࡋࡎࡕࡇࡕࠤࡕࡇࡓࡔ࡙ࡒࡖࡉࠦ࠾ࠨࠤ"), 0, l1l1111_opy_) # end l11l11_opy_ # clear window window.clear() # l1l_opy_ l1ll11l_opy_ l1l1lll_opy_ # l1l_opy_ l1111l_opy_ # l11ll1l_opy_ x l1l11l1_opy_ l1ll1ll_opy_ = window.get_width() - window.get_string_width(l1111l_opy_) l1lll1l_opy_ = l1ll1ll_opy_ // 2 # l11ll1l_opy_ y l1l11l1_opy_ l1lll11_opy_ = 7 * l1llll1_opy_ l1l11ll_opy_ = window.get_height() - l1lll11_opy_ l1l1111_opy_ = l1l11ll_opy_ // 2 window.draw_string(l1111l_opy_, l1lll1l_opy_, l1l1111_opy_) window.update() sleep(0.3) l1l1111_opy_ = l1l1111_opy_ + l1llll1_opy_ # l1l_opy_ l1l111_opy_ line window.draw_string(l1ll1l_opy_(u"࠭ࠧࠥ"), 0, l1l1111_opy_) window.update() sleep(0.3) l1l1111_opy_ = l1l1111_opy_ + l1llll1_opy_ # l1l_opy_ l1ll11l_opy_ line 2
window.update() sleep(0.3) line_y = line_y + 2 * text_height #prompt for a password guess = window.input_string('ENTER PASSWORD >', line_x, line_y) #clear window window.clear() sleep(0.3) #display failure outcome line_x = (window.get_width() - window.get_string_width(guess)) / 2 line_y = (window.get_height() - (7 * text_height)) / 2 window.draw_string(guess, line_x, line_y) window.update() sleep(0.3) line_x = (window.get_width() - window.get_string_width('LOGIN FAILURE - TERMINAL LOCKED')) / 2 line_y = line_y + 2 * text_height window.draw_string('LOGIN FAILURE - TERMINAL LOCKED', line_x, line_y) window.update() sleep(0.3) line_x = (window.get_width() -
from uagame import Window from time import sleep # create window window = Window('hello', 300, 200) string_height = window.get_font_height() # prompt user input_string = window.input_string('Enter string >', 0, 0) # set text in the right corner x_space = window.get_width() - window.get_string_width(input_string) y_space = window.get_height() - window.get_font_height() # draw text window.draw_string(input_string, x_space, y_space) window.update() sleep(2.0) # close window window.close()
window.update() sleep(0.3) line_y = line_y + string_height window.draw_string("", 0, line_y) window.update() sleep(0.3) line_y = line_y + string_height # prompt for guess guess = window.input_string("ENTER PASSWORD >", 0, line_y) # end game # clear window window.clear() # display failure outcome # display guess # compute x coordinates x_space = window.get_width() - window.get_string_width(guess) line_x = x_space // 2 # compute y coordinates outcome_height = 7 * string_height y_space = window.get_height() - outcome_height line_y = y_space // 2 window.draw_string(guess, line_x, line_y) window.update() sleep(0.3) line_y = line_y + string_height # display blank line window.draw_string("", 0, line_y) window.update() sleep(0.3) line_y = line_y + string_height
line_depth += window.get_font_height() sleep(0.3) window.draw_string('', 0, line_depth) window.update() line_depth += window.get_font_height() sleep(0.3) guess = window.input_string('ENTER PASSWORD >', 0, line_depth) if guess == 'HUNTING': window.clear() line_depth = (window.get_height()-7*window.get_font_height())//2 window.draw_string(guess, (window.get_width()-window.get_string_width(guess))//2, line_depth) line_depth += window.get_font_height() window.update() sleep(0.3) window.draw_string('', 0, line_depth) line_depth += window.get_font_height() window.update() sleep(0.3) window.draw_string('EXITING DEBUG MODE', (window.get_width()-window.get_string_width('EXITING DEBUG MODE'))//2, line_depth) window.update() sleep(0.3) line_depth += window.get_font_height() window.draw_string('', 0, line_depth)
if guess == 'HUNTING': outcome_line2 = 'EXITING DEBUG MODE' outcome_line3 = 'LOGIN SUCCESSFUL - WELCOME BACK' prompt = 'PRESS ENTER TO CONTINUE' #create failure else: outcome_line2 = 'LOGIN FAILURE - TERMINAL LOCKED' outcome_line3 = 'PLEASE CONTACT AN ADMINISTRATOR' prompt = 'PRESS ENTER TO EXIT' #display outcome line_x = (window.get_width() - window.get_string_width(guess)) / 2 line_y = (window.get_height() - (7 * text_height)) / 2 window.draw_string(guess, line_x, line_y) window.update() sleep(0.3) line_x = (window.get_width() - window.get_string_width(outcome_line2)) / 2 line_y = line_y + 2 * text_height window.draw_string(outcome_line2, line_x, line_y) window.update() sleep(0.3) line_x = (window.get_width() - window.get_string_width(outcome_line3)) / 2 line_y = line_y + 2 * text_height
def main(): # create window window = Window('Remember The Word', 500, 400) # display icon window.set_font_color('green') window.set_font_size(100) window_width = window.get_width() icon_width = window.get_string_width('UA') x_icon = window_width - icon_width y_icon = 0 window.draw_string('UA', x_icon, y_icon) # display instructions window.set_font_size(24) window.set_font_color('white') x = 0 y = 0 window.draw_string('A sequence of words will be displayed.', x, y) font_height = window.get_font_height() y = y + font_height window.draw_string('You will be asked which word starts with', x, y) y = y + font_height window.draw_string('a particular letter.', x, y) y = y + font_height window.draw_string('You win if you enter the right word.', x, y) y = y + font_height # prompt player to press enter window.input_string('Press the enter key to display the words.', x, y) # CLEAR WINDOW window.clear() # DISPLAY ICON window.set_font_size(100) window.set_font_color('green') window.draw_string('UA', x_icon, y_icon) # display words # display word 1 window.set_font_size(24) window.set_font_color('white') x = 0 y = 0 window.draw_string('orange', x, y) time.sleep(2) # CLEAR WINDOW window.clear() # DISPLAY ICON window.set_font_size(100) window.set_font_color('green') window.draw_string('UA', x_icon, y_icon) # display word 2 window.set_font_size(24) window.set_font_color('white') window.draw_string('chair', x, y) time.sleep(2) # CLEAR WINDOW window.clear() # DISPLAY ICON window.set_font_size(100) window.set_font_color('green') window.draw_string('UA', x_icon, y_icon) # display word 3 window.set_font_size(24) window.set_font_color('white') window.draw_string('mouse', x, y) time.sleep(2) # COPY AND PASTE HERE # CLEAR WINDOW window.clear() # DISPLAY ICON window.set_font_size(100) window.set_font_color('green') window.draw_string('UA', x_icon, y_icon) # display word 4 window.set_font_size(24) window.set_font_color('white') window.draw_string('sandwich', x, y) time.sleep(2) # CLEAR WINDOW window.clear() # DISPLAY ICON window.set_font_size(100) window.set_font_color('green') window.draw_string('UA', x_icon, y_icon) # get guess window.set_font_size(24) window.set_font_color('white') guess = window.input_string('What word starts with the letter c?', x, y) # CLEAR WINDOW window.clear() # DISPLAY ICON window.set_font_size(100) window.set_font_color('green') window.draw_string('UA', x_icon, y_icon) # display results window.set_font_size(24) window.set_font_color('white') if guess == 'chair': window.draw_string('Congratulations, you are correct.', x, y) else: window.draw_string('Sorry you entered ' + guess, x, y) y = y + font_height window.draw_string('The correct answer was chair.', x, y) # end game x = 0 window_height = window.get_height() y = window_height - font_height window.input_string('Press enter to end the game.', x, y) window.close()
# create failure else: outcome_line2 = "LOGIN FAILURE - TERMINAL LOCKED" outcome_line3 = "PLEASE CONTACT AN ADMINISTRATOR" # display failure outcome # display guess # compute x coordinates x_space = window.get_width() - window.get_string_width(guess) line_x = x_space // 2 # compute y coordinates outcome_height = 7 * string_height y_space = window.get_height() - outcome_height line_y = y_space // 2 window.draw_string(guess, line_x, line_y) window.update()
window.draw_string('PUTTING', 0, line_depth) window.update() line_depth += window.get_font_height() sleep(0.3) window.draw_string('', 0, line_depth) window.update() line_depth += window.get_font_height() sleep(0.3) entry = window.input_string('ENTER PASSWORD >', 0, line_depth) window.clear() line_depth = (window.get_height()-7*window.get_font_height())//2 window.draw_string(entry, (window.get_width()-window.get_string_width(entry))//2, line_depth) line_depth += window.get_font_height() window.update() sleep(0.3) window.draw_string('', 0, line_depth) line_depth += window.get_font_height() window.update() sleep(0.3) window.draw_string('LOGIN FAILURE - TERMINAL LOCKED', (window.get_width()-window.get_string_width('LOGIN FAILURE - TERMINAL LOCKED'))//2, line_depth) window.update() sleep(0.3) line_depth += window.get_font_height() window.draw_string('', 0, line_depth)