Notes Same Principles

Notes Same Principles

Notes Same Principles as Before
In this lab we will be combining our efforts in top-down programming, where we deliberately organize and structure our code with main functions and sub functions, but will also add in our skills in Graphic User Interface (GUI). We continue to build abstraction – where a few small, simple and concrete tasks are packaged together to perform a more general task. The top-down approach helps us organize our code like an outline organizes our writing. Again, we start with an algorithm (chart), then translate it into pseudocode of comments and function name definitions.

In the last lab you created code to play Rock-Paper-Scissors. You will be working with the same code (modify to resolve comments from your last lab), but rather than using input() you will now collect input using the GUI. Be creative about displaying messages to the player.

Submittal to
Because plagiarism in coding is dishonest, unethical, and is against the Miramonte Honesty Policy, you are required to submit your code to Make a Google Doc with your final code for Rock-Paper-Scissors and Word Jumble, and submit it to, Lab #8.

Problem #1 – Rock-Paper-Scissors Reprise (with GUI)
Game Requirements

1. Display messages on the canvas that explain to the user how to choose Rock, Scissors, or Paper. They may not input their choice with any text input box.

2. Once the player makes their selection, have the computer make a selection. Display both the player’s and computer’s selection on the Canvas (it is good programming practice to also display on the console to help you debug).

3. Display the outcome (“You win!” or “Computer wins!”)

4. Tally and update the score after each iteration of the game.

5. You do not have to ask the user to play again… you can assume they will, but do give them some method to Quit when they are ready.

6. When they quit, display a parting message and the final score.

RPS starter code

Rock-Paper-Scissors GUI starter code – copy/paste into Codeskulptor and build code.


import simplegui
import random

“””Overview of Game Logic:
1. Screen is drawn with blank values, input method for player RPS
is explained/presented
2. Player selects R, P, or S using some form of
GUI input (no input box).
3. Computer randomly selects option R, P or S
4. Winner is identified, results shared, score updated and posted
5. Repeats #2-4 each time a button, key-stroke, or mouse-click
is initiated.
4. Stops when quit is pressed/clicked.
###### INITIALIZATION CODE ##################

#Global variables, changed within functions below

# Canvas Dimensions
canvas_width =
canvas_height =

####### RPS algorithm helper functions ########

#Computer Generator
def comp_choice():
“””Will randomly select Rock, Paper, or Scissors. “””
#global variables here.
#pick a random R, P, or S….
#Update computer choice message for draw handler
#call winner() to determine outcome

#Determine Winner
def winner():
“””Determine the winner then updates the score”””
#global variables here
#determines the winner
#updates the necessary draw(canvas) variables to show messages

########### EVENT HANDLERS #####################
#define event handlers for mouse click, buttons, input box, key_strokes, draw

# Player Choice Selection (not input box).

def button_quit_handler():
#global variable here
#updates the necessary draw(canvas) variables

# Handler to draw on canvas
def draw(canvas):
#Player choice: use canvas.draw_text(parameters), pass in message as variable
#Computer choice
#Winner text and score update
#Any additional messaging

# Create a frame and assign callbacks to event handlers
frame = simplegui.create_frame(“Rock, Paper, Scissors”, canvas_width, canvas_height)
frame.add_label(‘Player Choice: Select One’)
frame.add_button(#add parameters)
frame.set_draw_handler(#add parameter)
#add more frame.set for key handler, buttons, mouse click, etc.

# Start the frame animation


Insert Final, working Rock-Paper-Scissors with GUI code – include detailed comments


<<your code here>> – please format with Code Blocks add-on – Python, github-gist

Problem 2: Word Jumble
As you solve a problem or write a computer program, the process should be:

1. Understand the task/purpose of code

2. Organize main task into sub-tasks and consider task flow (sequencing)

a. Create flow structure with an algorithm flow chart (whiteboard!). Consider collaborating with a programming partner as you plan.

b. Create pseudocode outline with comments, naming key flow functions.

3. Build, code and test sub-functions first. Debug as you go. Revise plan/structure as necessary.

4. Combine sub-functions into larger program and test, test, test! Revise plan as necessary.

5. Consider extensions or improvements to original design.

Keep your words to 5 and 6 letters each. This is like the Jumble in the newspaper and online games and will make the GUI display easier and more aesthetically pleasing.




Development Process

Part 1: Backend Development

Part 2: Frontend Development

You need to create a program that allows a user to guess a word that has been jumbled together. This project focuses on Strings and String manipulation, as well as presenting output with the GUI.

Note, this is modeled after the Create Performance Task that you will submit as part of your AP Portfolio. You will submit your code write up via Google Classroom and

Support Materials:
1. Video of Frontend and Backend

2. String randomizer

Development Process
Part 1: Backend Development
You will create a word jumble game. You should use functions to help you both pick a word from a list, scramble it and then prompt the user for guesses. Below is a rough outline of the pseudocode. You do NOT need to use this structure, but you SHOULD have some structure in place before you start writing code. Think of this as the outline.

Your first working version of the game will rely on input() and printing to the Console. We call this “Backend Development,” where we get the algorithm and flow working correctly.

Note, you may find the method, random.shuffle(some_list), to be helpful when scrambling the word. You will find the documentation in the Random Module

Optional Extension

Add a timer to your game. Give the user 30 seconds to guess the jumbled word.

How do you place an order?

It takes a few steps to place an order with Us:

  • The first step is to place your order. You will need to provide us with some basic information about your project.
  • Once you have placed your order, you will be taken to our secure payment page.
  • Once we receive your order, we will carefully review it and match you with a writer who has the skills and experience.
  • Stay in contact with the writer and discuss vital details of research.
  • Your completed proposal will be delivered via email within the specified deadline.

You are secure when using our service

It's critical for each client to feel secure. As a result, we at Research Proposal Writing take precautions to secure your data.

Financial security You may securely pay for your purchase using a variety of secure payment methods.
Personal security The personal information of our clients is secure. Nobody else will have access to it.
Academic security We use a specialized program to check every completed paper to ensure that we deliver no-plagiarism samples.
Web security This website is safe from unauthorized breaches. We maintain our privacy management in line with the latest laws and regulations.

You can get help placing your order. If you have any questions about our services, please contact us. Our support staff is accessible 24 hours a day, 7 days a week.

If you're still looking for a way to improve your grades and hire expert writers, we've got you covered. Place an order on our website, and we'll help you with any paperwork you want. We will exceed your expectations.

Order now Get a quote