Lecture07-CodeBreaker-part1-3pp

Our case the codemaker will be the computer ie the

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: t are: •  Of the right color and in the right place •  Of the right color but out of place   The game ends if the codebreaker guesses the paPern or runs out of rounds 4 CMPUT174  ­ ­ Design & Problem Solving Example: Codebreaker game • In our case, the codemaker will be the computer (i.e., the program) and the codebreaker will be the user • We will start with a fixed code word • We will use lePers instead of pegs to represent the paPern   We will use 6 lePers (A, B, C, D, E, F) and we will allow repe::on   PaPerns are four ­lePer codes (e.g., “ABCB”) • We will go for a fixed number of rounds (10 in our case) 5 CMPUT174  ­ ­ Design & Problem Solving How to start? • What kind of program is this? data processing pipeline? interac:ve program? • It is an interac:ve program, which means that there will be a while loop:   Ask the user for a guess;   Test if the guess is valid (4 lePers, only A, B, C, D, E, and F)   Give feedback to the user CMPUT174  ­ ­ Design & Problem Solving 6 2 13 ­10 ­01 How to start? • Read the specs • Ask ques:ons (to yourself and others) • Take notes as you go   Write down every decision you make • Draw diagrams   Ask if they are right,...
View Full Document

Ask a homework question - tutors are online