CSC151 2007S, Class 12: Boolean Values and Predicate Procedures Admin: * Reminder: Extra credit for attending Tony Leguia's talk on Thursday. 4:30, 3821 * Should I tell admissions to keep prospective students away from the class? * Consensus of those willing to speak: No, it's fun to play with them * Assignment 7 is now ready. Please try to spend under an hour on it. * Reading for tomorrow: Conditionals. * On too-long labs. Overview: * Boolean values. * Predicates - Procedures that return Boolean values. * Combining booleans with and and or. One set of instructions for Part 2.e: Start with (rgb.light? (rgb.new 256 256 256)) If this returns true, subtract 128 to each value in rgb.new If this returns false, add 128 At the second step, if true, subtract 64. If false, add 64 At the third step, if true, add 32. If false, add 32. Etc. Another set of instructions for Part 2.e Pick some integer between 0 and 255, inclusive. Call it g Determine if (rgb.new g g g) is considered light * If so, determine if (rgb.new (- g 1) (- g 1) (- g 1)) is considered light * If not, we're done * If so, pick another number Another set of instructions Start with (rgb.new 255 255 255) * Repeatedly subtract ten from each component until you find a color that is considered dark * Repeatedly add one to each component until you have a color that is considered light * You're done And another: * Use algebra /Debrief/ * The way in which < works is confusing to some + (< 5 x) means "is 5 less than x" not "is x less than 5" + Remember: We're essentially moving the operation to the left 5 < x => (< 5 x) * Multiple ways to solve the same problem