Lecture07-CodeBreaker-part1-3pp

Option1 start wring the program with what you have

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: es on for a fixed number of rounds! Start Ask first guess • What do we do?   OPTION1: implement the game that goes forever and add the test for the number of rounds later   OPTION2: iterate and refine the current design CMPUT174  ­ ­ Design & Problem Solving check guess give feedback Ask new guess FALSE correct guess? TRUE print hurray! Stop check guess 12 4 13 ­10 ­01 Iterate and refine • Itera:ng and refining the current design seems easy enough Start Ask ?rst guess • Refining means making a decision (or commitment) about how the program will work   You can always change change your mind if you dislike how you designed the program later on check guess TRUE FALSE give feedback Keep Going? Ask new guess check guess TRUE print hurray! DECISION FALSE print sorry! right guess? Stop Stop continue = count < limit and guess != code 13 CMPUT174  ­ ­ Design & Problem Solving Iterate and refine • What next? • OPTION1: start wri:ng the program with what you have   Variables (turn, limit, guess, …)   While a loop   Print “hurray” if the guess is right • OPTION2: focus on the more complex “boxes”: Start Ask first guess check guess TRUE Ask new guess FALSE Keep Going?...
View Full Document

This document was uploaded on 03/02/2014.

Ask a homework question - tutors are online