Presentation is loading. Please wait.

Presentation is loading. Please wait.

Big problem  small steps

Similar presentations


Presentation on theme: "Big problem  small steps"— Presentation transcript:

1 Big problem  small steps
Top Down Design Big problem  small steps

2 We have a problem! Making a video game or making a small program Mr. Hastings has asked you to make, every program solves some problem Starting with a big picture idea (“This is what I want to make”). What do you want to happen? Take that big problem and break it into smaller steps Take those smaller steps  break into manageable steps.

3 Outline = A Plan Now that we know what specific tasks we need to accomplish before solving our problem we have a plan of action. Just like building a house, some steps are necessary to complete first before doing anything else (drawing blueprint for house, getting permits, hiring contractors, etc…) Just like building a house, some steps are independent of others (painting once walls are up, independent of landscaping outside)

4 Rock Paper Scissors game
Let’s use our RPS game program as an example: Top down design begins with a BIG PROBLEM (I want to make a game) Breaks that down into sections (I will need to keep score… I will want to know who wins a match… I want some sort of dialogue in the game) Let’s look at what we did as a class with our game design:

5 Tasks: We need to use the random function. We want the computer to be both unpredictable and unbiased [it won’t cheat] Create a list of possible choices [rock, paper, or scissors] Human chooses a R,P, or S Computer chooses randomly between R,P, or S

6 Tasks Define a function recognizing user’s input
We don’t want to have to repeat typing code  create a game function (asks What your choice is, chooses, then evaluates and repeats)

7 Tasks There needs to be an order / timing (control flow) for gameplay
Human chooses first Computer chooses second Choices are compared / evaluated If human chooses ‘R’ and comp chooses ‘P’: comp wins… If human chooses ‘P’ and comp chooses ‘S’: comp wins… If human chooses ‘S’ and comp chooses ‘R’: comp wins… Else: HUMAN WINS!!!  Winner declared Win recorded / counted

8 Tasks Rules! What beats what? R > S P > R S > P

9 Tasks Win is recorded Keeping Score! How will we know who wins
User win or computer win After x wins, computer or human wins match (best of x matches)


Download ppt "Big problem  small steps"

Similar presentations


Ads by Google