Light Bot Solutions: an analysis

Slides:



Advertisements
Similar presentations
Identify the number of solutions of an equation
Advertisements

 Communication:  Provide context, e.g., s …  TA Office hour for next Tuesday: CANCELLED  My name is: ??  Show  Scores on-line, Quiz-1 results.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Changing Control.
CS107 Introduction to Computer Science Loops. Instructions Pseudocode Assign values to variables using basic arithmetic operations x = 3 y = x/10 z =
Ch 1.4 – Equations & Inequalities
Ch 3.3 – Solving Multi-Step Equations
analysis, plug ‘n’ chug, & induction
Algebra 1: Solving Equations with variables on BOTH sides.
Copyright Kenneth M. Chipps Ph.D. 1 How To Do VLSM Last Update
Solve Equations with Variables on Both Sides
Welcome – You’ve found CSE120 OR Computer Science Principles OR UWIT…  Announcements are usually listed here and displayed before the start of class 
Linear Equations, Inequalities, and Absolute Value - Solving Linear Equations METHOD #1 – Inspection Some equations are easy to solve. Ones that have one.
EXAMPLE 1 Solve an equation with variables on both sides 7 – 8x = 4x – 17 7 – 8x + 8x = 4x – x 7 = 12x – = 12x Write original equation. Add.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 What can a computer be commanded to do?
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Assignment 6.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 We’re underway …
Inequalities and their Graphs Objective: To write and graph simple inequalities with one variable.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004.
Warm Up – 8/28/12 Bring Kleenex EC opportunity due next week. Put in box up front. Make sure your name and period is on it. We buy our workbooks on Friday,
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Functional Abstraction Reduces Complexity.
Lesson  Draw an array to match my picture.  Skip-count by twos to find how many total objects there are.  How many groups of 2 are there?  Say.
Two paths diverge in the lectures 2 Think of the first as concepts, the second as capabilities This ClassPrinciplesDoing stuff.
Ch 3.3 – Solving Multi-Step Equations
August 31 Intro to CS.
Vocabulary Algorithm - A precise sequence of instructions for processes that can be executed by a computer Low level programming language: A programming.
Entry Task Factor 9x2 – 25 (3x – 5)(3x + 5).
Inequalities and their Graphs
Inequalities and their Graphs
Lightbot and Functions CSE 120 Winter 2017
2-4, 2-5 Warm Up
Introduction to Programmng in Python
Light Bot Solutions: an analysis
Domain Name System Relating the “logical” with the “physical”
Announcement Tomorrow’s office hr: CANCELLED! Show work!!
To do … Web Exercise: Quiz-3, HW#2 Score: update
Last Class We Covered Data representation Binary numbers ASCII values
Inequalities and their Graphs
“Human Sorting” It’s a “Problem Solving” game:
Lightbot and Functions CSE 120 Winter 2018
Last Class We Covered Dictionaries Hashing Dictionaries vs Lists
Inequalities and their Graphs
Announcements Mid-Term Exam!! Quiz 5 Again + Quiz 6 Exercise 5
Light Bot Solutions: an analysis
Announcement Function ppt: download again
Announcements How’s it going? My internet/power supply?
Digital Thinking: Animation, Video Games, and the Social Web
Topic 1: Problem Solving
Announcements SGID Feedback! Thank you!! Readings:
Announcements: Reading materials are posted on Discussion Board.
Michigan Lean Consortium Exercise Instructions
Algorithms.
Announcements Survey … no really, you will be polled
Two Paths Diverge in the Lectures
Variables, Assignments Testing + Iteration
New Seat Once you have found you seat
Unit 1: Principles of Computer Science
Digitization & Processing
Announcements How to save your work? Quiz solution 5/5/2019
Announcements: Questions: Names on the board? Why?
Basic Processing … Drawing pictures … It’s not art, it’s fun
Digital Thinking: Animation, Video Games, and the Social Web
Lawrence Snyder University of Washington
Routines for Reasoning
“Human Sorting” It’s a “Problem Solving” game:
Announcements Survey feedback: summary Quiz: HW 7:
U3L4 Using Simple Commands
Today: to list: Syllabus change: Grade on-line
Announcements Jack group member by Thursday!! Quiz-8? HW10
Lecture 6 - Recursion.
Presentation transcript:

Light Bot Solutions: an analysis Let’s gather our thoughts … on LightBot … Light Bot Solutions: an analysis Kelvin Sung University of Washington, Bothell (* Use/Modification with permission based on Larry Snyder’s CSE120 from Winter 2011) © Lawrence Snyder 2004

Today: Consent to participate in research Announcements: Watch out: Exercise vs Assignments in Submission Email Exercise! Thank you Analyze what we did in HW1 Analyze solution to HW2 Talk about HW3 (due next class) In-class Weekly survey Exercise 2, if time Exercise 3 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Questions? Comments? Here is your graded HW1 Summary of your HW1 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Goal for today: Practice Abstraction An instruction (of the Lightbot or any other computer) is abstracted into the command name; functions abstract useful and meaningful operations, functions abstract functions built of functions, etc. Layer upon layer, we build software solutions 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

What did we learn? Find a pattern (problem): give it a name form a concept: functional abstraction Solve the problem by defining a function F1( ): Process Riser F2( ): Move To Next Riser 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Pattern? 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Process of finding a pattern? Method 1: Brute force: S + P + S + P + S + P + S + P … Stare at the solution! Repeated: Step + Power! Answer: Define ProcessOne() SP Function name + Function Body Repeatedly invoke (call) ProcessOne until done. 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Brute force is ok … or ? Method 2: observations 3 strips of identical “thinging” How to solve one “strip”? Define ProcessOneStrip() SPSPSP There are 3 strips so … Answer: 3: ProcessOneStrip Both solutions are equally good! 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

How about this one? 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Pattern? What patterns do you see? 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Pattern? 3 identical strips of Abstractions: Strip has Two connected 2 steps Abstractions: Strip has TwoSteps “Turn”: connecting the steps 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Solving all concepts Def ProcessOneStrip() Def ProcessTwoSteps() MakeTheTurn Power Def ProcessTwoSteps() SS Def MakeTheTurn() LSL 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Solution to problem Verbally 3:(ProcessOneStrip : L) Process first strip Turn Left Process second strip Process third strip 3:(ProcessOneStrip : L) 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

How about this? Pattern? 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

How about this? Pattern? Obvious one: Any other pattern? So: 4x connected sides A side is 4 steps + Power Any other pattern? Too simple Not obvious enough So: How to get to the beginning of first pattern? 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Solution … Get to the pattern: Def ProcessAnEdge() Solution: PJPJPLSS or 2:(PJ)PL2:(S) Def ProcessAnEdge() SSSSPL Solution: GetToThePattern 4:(SSSSPL) 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Fun yet? Pattern? 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Fun yet? Pattern? Facing: Front step need power Left step need power 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Solution? Solution: Notice: Def ProcessFacing() After ProcessFacing J P L J P L L Notice: After ProcessFacing The problem repeats itself!! Well, almost … 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

One small (but important) Point Power: Toggles NOT: on/off Observe Odd ones: Off Even ones: On Each block: Has 3 sets of “Facing” 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Last one … Pattern? 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Last one … Pattern? 4 sets of Def ProcessStairs() 3-step stairs Observation: Up and down are the same (we knew this!) Def ProcessStairs() J J J P 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Trickier … StairSet: 2 StairSets! Two stairs with Connected with Power + L 2 StairSets! 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Process StairSet … Def ProcessStairSet() ProcessStairs L 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Today: Practice Abstraction Brute force: List out solution, find patterns from the solution Observe problem Break into smaller problems that repeat themselves in the original problem Define function: solution for the smaller problem Re-use function Can be tricky to observe pattern! 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)

Today: Consent to participate in research Announcements: Watch out: Exercise vs Assignments in Submission Email Exercise! Thank you Analyze what we did in HW1 Analyze solution to HW2 Talk about HW3 (due next class) In-class Weekly survey Exercise 2, if time Exercise 3 12/30/2018 Kelvin Sung (Use/modify with permission from © 2010 Larry Snyder, CSE)