Lightbot and Functions CSE 120 Winter 2017

Slides:



Advertisements
Similar presentations
 Communication:  Provide context, e.g., s …  TA Office hour for next Tuesday: CANCELLED  My name is: ??  Show  Scores on-line, Quiz-1 results.
Advertisements

1 Chapter Five Selection and Repetition. 2 Objectives How to make decisions using the if statement How to make decisions using the if-else statement How.
Chapter 2 The Algorithmic Foundations of Computer Science
C How to Program, 6/e Summary © by Pearson Education, Inc. All Rights Reserved.
Recursion, Complexity, and Searching and Sorting By Andrew Zeng.
Institute for Personal Robots in Education (IPRE)‏ CSC 170 Computing: Science and Creativity.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 We’re underway …
15-100: Introduction to Programming w/ Java * Ananda Gunawardena -- Lecture – School of Computer Science – Phone : (x81559) – Office: Wean Hall.
© Janice Regan, CMPT 128, February CMPT 128: Introduction to Computing Science for Engineering Students Recursion.
Agent program is the one part(class)of Othello program. How many test cases do you have to test? Reversi [Othello]
The Beauty and Joy of Computing Lecture #6 Algorithms I Jon Kotker UC Berkeley EECS 2010, 2013 Microsoft
JavaScript: Conditionals contd.
How Do You Make a Program Wait?
Nested Loops & Arrays CSE 120 Spring 2017
INTRODUCTION TO ROBOTICS Part 5: Programming
Advanced Algorithms Analysis and Design
Expressions & Control Flow CSE 120 Spring 2017
ICS 3UI - Introduction to Computer Science
Topic: Programming Languages and their Evolution + Intro to Scratch
Processing Introduction CSE 120 Spring 2017
Putting Objects in Motion
Topic: Recursion – Part 1
Developing an App CSE 120 Spring 2017
Functions in Processing CSE 120 Spring 2017
IF statements.
Topic: Functions – Part 2
The Selection Structure
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Algorithm Analysis CSE 2011 Winter September 2018.
Chapter 8: Control Structures
Web Programming– UFCFB Lecture 16
Yenka Portfolio Level for this topic: Student Name : My Levels
Functions in Processing CSE 120 Winter 2018
Variables & Datatypes CSE 120 Winter 2018
Writing to Learn vs. Writing in the Disciplines
Processing and Drawing CSE 120 Winter 2018
LESSON 11 – WHILE LOOPS UNIT 5 – 1/10/17.
Mid-Quarter Review CSE 120 Spring 2017
Problem Solving & Algorithms
Expressions & Control Flow CSE 120 Winter 2018
Written Description of Algorithms
Binary Numbers CSE 120 Spring 2017
Objective of This Course
Variables & Datatypes CSE 120 Spring 2017
UNIT 3 CHAPTER 1 LESSON 4 Using Simple Commands.
First Python Program Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
Programming Fundamentals (750113) Ch1. Problem Solving
Lightbot and Functions CSE 120 Winter 2018
Strings, Puzzle App I CSE 120 Winter 2018
Loops CIS 40 – Introduction to Programming in Python
Structured Programming Taken from notes by Dr. Neil Moore
Testing and Repetition
Algorithm and Ambiguity
Maze Challenge Maze Challenge activity > TeachEngineering.org
CSC115 Introduction to Computer Programming
Two Paths Diverge in the Lectures
Unit 3 lesson 2-5 The Need For Algorithms- Creativity in Algorithms – Simple Commands - Functions Day 18.
ECE 352 Digital System Fundamentals
Chapter 5 Architectural Design.
Chapter 2 – part a Brent M. Dingle Texas A&M University
STEM Day Sioux City, Iowa
Running a Java Program using Blue Jay.
Bellwork 8 minutes 7 minutes 9 minutes 10 minutes 12 minutes
Hour of Code Code.org/lightbot
Classes and Objects Object Creation
Today: to list: Syllabus change: Grade on-line
Expressions & Conditionals CSE 120 Winter 2019
CMSC 202 Constructors Version 9/10.
Presentation transcript:

Lightbot and Functions CSE 120 Winter 2017 Instructor: Teaching Assistants: Justin Hsia Anupam Gupta, Braydon Hall, Eugene Oh, Savanna Yee As Congress Repeals Internet Privacy Rules, Putting Your Options In Perspective Passed by the Federal Communications Commission in October, the rules never went into effect. If they had, it would have given consumers more control over how ISPs use the data they collect. Most notably, the rules would have required explicit consent from consumers if sensitive data – like financial or health information, or browsing history – were to be shared or sold. These rules wouldn't have applied to the likes of Google or Facebook – massive data collectors and digital advertisers. But consumer groups argue… you could abandon those companies in favor of other websites, if you disagree with their policies; switching Internet providers is not so easy. http://www.npr.org/sections/alltechconsidered/2017/03/28/521813464/as- congress-repeals-internet-privacy-rules-putting-your-options-in-perspective

Administrivia Check-in How is Exploring Lightbot going? (due tonight) How is your portfolio setup going? (due Friday) Sorry that we are not teaching you HTML/CSS Any questions on course navigation? Reading Check 1 is on Canvas and due in the 24 hours preceding your Thursday lab 20 minutes, short answer Personal Values assignment due Sunday (4/2)

As Experienced Lightbot Players… What are you doing in Lightbot? Commanding a robot through a world of blocks and switches

As Experienced Lightbot Players… What are you doing in Lightbot? Commanding a robot through a world of blocks and switches Programming is commanding an agent In this case, the agent is a robot The agent is usually a computer, but could be a person or other device

As Experienced Lightbot Players… What are you doing in Lightbot? Commanding a robot through a world of blocks and switches Programming is commanding an agent In this case, the agent is a robot The agent is usually a computer, but could be a person or other device Direct an agent to a goal by giving it instructions The agent follows the instructions flawlessly and mindlessly The trick is to find the right instructions to match your intent

Order of Instructions Instructions are given in order (i.e. in a sequence) The 1st instruction is completed, then the 2nd, then the 3rd, … You issue the instructions and the agent follows them When the agent is following your instructions, this is called executing the program, or running the program

Order of Events The instructions are programmed ahead of time, and then executed later The programmer cannot intervene until the program has finished executing or is terminated prematurely The instructions must be correct in order for the agent to achieve its goal

Point of View Programming requires you to take the agent’s point of view Because it is a sequence of instructions, you must account for everything that happened before (i.e. trace the program) There is usually an indication of where you are currently in the program (sometimes called a program counter)

Limited Instructions The number and type of instructions is always limited The agent can only do certain pre-defined actions The agent can only execute one instruction at a time Must learn how to specify complex tasks using just these simple actions

Limited Instructions Limited instructions is a reality of all computing A computer’s hardware/circuitry can only execute a small number of instructions – usually about 100 Many are just different versions of the same idea Amazing Fact: In theory, a computer with just SIX instruction types could compute all known computations!

Back in Reality Programming would be amazingly tedious if you could only use the basic instructions No one would be a programmer no matter how much it paid! The amazing applications we see today would not exist The early days of programming were like this Tedious and error-prone Muscle/neuron firing analogy for standing up

Solution: Functions! Functions allow us to create new, more complex instructions for our agents Below, F1 is a function to “process a riser” We can call a function by name (F1) to execute its instructions

Choosing Functions The goal is to break down a complex problem into smaller/simpler ones Look for common patterns “Process a riser” looks like a useful sub-problem because there are three of them [DEMO] Point 1: Abstraction Point 2: Generalization

Choosing Functions One possible solution is shown below: 17 commands, 29 calls

Choosing Functions Modified solution is shown below: Now F2 is a function to “move to next riser” 16 commands, 31 calls 5 conceptual steps rather than 26 bare instructions

Choosing Functions Yet another solution shown below: F1 is “traverse steps”, F2 is “process riser and move to next” 12 commands, 35 calls 3 repeated conceptual steps

Recursion Special case where a function calls itself “Conceptual unit” might apply again, immediately More about this later in the course

Peer Instruction Question Which of the following statements is TRUE? Vote at http://PollEv.com/justinh An agent can learn new instructions It is the agent’s fault if the goal is not achieved All ways to decompose a problem into functions are equally good None of the above We’re lost…

Functions Summary Functions may seem “obvious” to you, but they are a foundational idea of computer science Abstraction in action! Functional abstraction helps us solve problems: Reduce complexity: identify and solve a coherent activity or action (sub-problem) that can be reused Associate these sub-problems with intuitive names Solve the whole problem by composing functions There is no “correct” way to abstract!

Looking Forward Continue to explore the concept of programming in the realm of Lightbot Now symbolically – not restricted by computer or clicking Symbolic Lightbot Start in lab tomorrow, due Friday (3/31) Use handwritten symbols for instructions Lightbot Functions Create functions using handwritten symbols F.turnaround() R,R.