daily pastebin goal
46%
SHARE
TWEET

Untitled

a guest Oct 12th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def create_window():
  2.     # Create a window
  3.     # return: a new uagame.Window object
  4.     title = 'Word Puzzle'
  5.     width = 600
  6.     height = 750
  7.     return Window(title,width,height)
  8.  
  9.  
  10. def draw_line(window, string, string_coords):
  11.    
  12.     # Display the string at the position string_coords and update the
  13.     # y coordinate in string_coords to be one 'line' lower
  14.     # - window is the uagame.Window object to draw to
  15.     # - string is the string to display
  16.     # - string_coords is a list containing the x,y int coordinates where
  17.     # the next line should be displayed    
  18.    
  19.     window.draw_string(string, string_coords[0], string_coords[1])
  20.     string_coords[1] += window.get_font_height()
  21.  
  22.    
  23. def display_instructions(window, instructions, string_coords):
  24.  
  25.     # Display the instructions for the game
  26.     # - window is the uagame.Window object to draw to
  27.     # - instructions is a list of strings containing the game's instructions
  28.     # - string_coords is a list containing the x,y int coordinates where
  29.     # the next line should be displayed  
  30.     for instruction in instructions:
  31.         draw_line(window, instruction, string_coords)
  32.  
  33.  
  34. def display_puzzle_string(window, puzzle, string_coords):
  35.  
  36.     # Display the current state of the puzzle to the screen.
  37.     # Letters which have been guessed will be revealed.
  38.     # Non-guessed letters will be replaced with underscore
  39.     # characters.
  40.     # - window is the uagame.Window object to draw to
  41.     # - puzzle is a list representing the puzzles current state,
  42.     # each element is either a letter if that letter has been
  43.     # guessed, or an underscore if it has not.
  44.     # - string_coords is a list containing the x,y int coordinates where
  45.     # the next line should be displayed
  46.     progress_message = 'The answer so far is: {}'.format(' '.join(puzzle), string_coords)
  47.     draw_line(window, progress_message, string_coords)
RAW Paste Data
Top