Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def create_window():
- # Create a window
- # return: a new uagame.Window object
- title = 'Word Puzzle'
- width = 600
- height = 750
- return Window(title,width,height)
- def draw_line(window, string, string_coords):
- # Display the string at the position string_coords and update the
- # y coordinate in string_coords to be one 'line' lower
- # - window is the uagame.Window object to draw to
- # - string is the string to display
- # - string_coords is a list containing the x,y int coordinates where
- # the next line should be displayed
- window.draw_string(string, string_coords[0], string_coords[1])
- string_coords[1] += window.get_font_height()
- def display_instructions(window, instructions, string_coords):
- # Display the instructions for the game
- # - window is the uagame.Window object to draw to
- # - instructions is a list of strings containing the game's instructions
- # - string_coords is a list containing the x,y int coordinates where
- # the next line should be displayed
- for instruction in instructions:
- draw_line(window, instruction, string_coords)
- def display_puzzle_string(window, puzzle, string_coords):
- # Display the current state of the puzzle to the screen.
- # Letters which have been guessed will be revealed.
- # Non-guessed letters will be replaced with underscore
- # characters.
- # - window is the uagame.Window object to draw to
- # - puzzle is a list representing the puzzles current state,
- # each element is either a letter if that letter has been
- # guessed, or an underscore if it has not.
- # - string_coords is a list containing the x,y int coordinates where
- # the next line should be displayed
- progress_message = 'The answer so far is: {}'.format(' '.join(puzzle), string_coords)
- draw_line(window, progress_message, string_coords)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement