Boğaziçi Ünv Koç Ünv Darüşşafaka Lisesi

Slides:



Advertisements
Similar presentations
1 karel_IF_part1 Conditional Statements Flavor 1: if ( ) { } For now: these are method invokations (see next slide)
Advertisements

1 of 3 Karel Karel is an educational programming language for beginners, created by Richard E. Pattis (currently at Pace University, NY). Pattis used the.
Copyright, Joseph Bergin
1 karel_part4_functions.ppt Functions Functions return values or Objects. –Using a function allows the programmer to focus on other task. –Using a function.
INTRODUCTION Chapter 1 1. Java CPSC 1100 University of Tennessee at Chattanooga 2  Difference between Visual Logic & Java  Lots  Visual Logic Flowcharts.
Lecture 2 Calling and Defining Methods in Java. Introduction ●Calling and defining methods ●Declaring and defining a class ●Instances of a class ●The.
1 Karel J Robot-Lesson 3 NTSD-Mr. Moon Karel J Robot Lesson 3 A Gentle Introduction to the Art of Object-Oriented Programming in Java.
CMPUT 101 Lab # 2 September 17, :00 – 16:50.
Movement. Fixed Movement setLocation (x, y) Makes the crab move to a fixed cell x,y Relative Movement The functions: getX() getY() Fetch the x and y coordinate.
Karel the Robot -- ITERATE Problem Statement: Karel is told to “take a walk around the block!” Revise Algorithm: Define move ahead 5 streets Define turnright.
CMPUT 101 Lab #2 Section: D12 September 18, 2008 Fraser Anderson.
Karel The Robot In the beginning… software. Karel the Robot  All robots are controlled by software  Artificially intelligent robots that can “think”
Polymorphism Are there different ways to solve the Harvester problem? – Robot teams – instead of one robot to solve a problem, let’s get a team of robots.
Robot? What’s a Robot? Introducing Karel-the-Robot.
Extending the Robot Programming Language In the Robot world 1 mile = 8 blocks Suppose we want a robot to run a marathon (26+ miles)? Does our program have.
Karel JRobot Karel is an educational programming language for beginners, created by Richard E. Pattis (currently at Pace University, NY). Pattis used the.
Chapter 5 Conditionally Executing Instructions
1 karel_part5_loops Iteration (Loops) Loops repeat a set of instructions Two types of loops: –Definite loops ( for ) perform instructions explicit (known)
Ch. 2 1 Karel – Primitive Instructions Basic tools with which all problems are solved (analogies: LeftSpinngingRobot, RightSpinningRobot, GuardRobot, etc)
Karel J Robot An introduction to BlueJ and Object- Oriented Programming.
1 Ch. 7 Recursion similar to iteration in that you repeatedly do a little bit of the task and then “loop” again and work on a smaller piece - eventually.
Karel the Robot A Gentle Introduction to the Art of Programming.
Programming Errors Lexical errors – occur whenever Karel reads a word that is not in his vocabulary. Example in English: We are asking directions and instead.
Thanks to Dr. Kris Schindler for this (and all Karel the Robot slides)
Recursion – means to recur or to repeat – A different way to get a robot to repeat an action A programming language that allows recursive definitions (and.
Karel J. Robot Tool for learning OOP (Lecture covers Ch. 1 and 2)
1 karel_part2_Inheritance Extending Robots Tired of writing turnRight every time you start a new karel project. How do we avoid re-writing code all the.
1 Karel – Chapter 6 Instructions That Repeat Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science.
1 Karel – Chapter 5 Conditionally Executing Instructions Note: Original slides provided by and modified for Mr. Smith’s AP Computer.
1 Karel J Robot OOP approach to learning computer science “Its study involves development of the ability to abstract the essential features of a problem.
15-100: Introduction to Programming w/ Java * Ananda Gunawardena -- Lecture – School of Computer Science – Phone : (x81559) – Office: Wean Hall.
Introduction to OOP in VB.NET using Robots ACSE Conference, Nov 2004 Michael Devoy Monsignor Doyle C.S.S., Cambridge
Extending Karel’s Vocabulary This PPT originated with Dr. Judy Hankins Modifications have been done by Dr. Untch & Dr. Cripps.
Programming in Karel Eric Roberts CS 106A January 6, 2016.
Mile-long hurdle race Suppose that we want to program Karel to run a one-mile long hurdle race, where vertical wall sections represent hurdles. The hurdles.
Karel the Robot – Review Primitive Commands move pickbeeper putbeeper turnleft turnoff Karel’s program statements are separated by a semicolon (;) Copyright.
1 Karel – Chapter 6 Instructions That Repeat Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science.
Karel the Robot – Review Primitive Commands move pickbeeper putbeeper turnleft Turnoff Karel’s program statements are separated by a semicolon (;) Copyright.
Karel the Robot – Review Primitive Commands move pickbeeper putbeeper turnleft Turnoff Karel’s program statements are separated by a semicolon (;) Copyright.
1 Chapter 5 Karel J Robot 2 Chapter 5 Chapter 5 Conditional Statements Flavor 1: if ( ) { } For now: these are method invocations (see next slide)
C++ Programming Basics C++ Lecture 1 Stacy MacAllister.
Greetings & Introductions & more
CS 106A, Lecture 3 Problem-solving with Karel
Karel – Primitive Instructions
Science app review By Amanda gagne.
Computer Programming.
Mile-long hurdle race Suppose that we want to program Karel to run a one-mile long hurdle race, where vertical wall sections represent hurdles. The hurdles.
In the beginning… software
Eric Roberts and Jerry Cain
Copyright © 2008 by Helene G. Kershner
Loops We have already seen instances where a robot needs to repeat instructions to perform a task turnRight(); moveMile(); Harvesting beepers in a field.
Copyright © 2008 by Helene G. Kershner
Karel J Robot.
karel_part4_functions_2
Karel – Primitive Instructions
Karel J Robot.
CS 106A, Lecture 2 Programming with Karel
CS 106A, Lecture 6 Control Flow and Parameters
SSEA Computer Science: CS106A
Geo 318 – Introduction to GIS Programming
Organizing Memory in Java
slides courtesy of Eric Roberts
A Gentle Introduction to the Art of Object Oriented Programming
Unit 1 Test 1 Redo Friday at 8am here or Friday 4th BLOCK in Math Lab
Nested If Statements While Loops
How to repeat information outside of a function!
CS 6640 Sample Presentation
Millennium High School Agenda Calendar
Indentation & Comments
Karel – Primitive Instructions
Presentation transcript:

Boğaziçi Ünv. 2015 Koç Ünv. 2016 Darüşşafaka Lisesi. 2014

Asena Bryce Julia

Nick Chris Lisa

Great team!... Some of them were in your place just 2 years ago

Pelin

Stanford? Language Call me Tyler I grew up in Arizona. Played a lot of soccer growing up. Really liked math/science.

Stanford I’m a graduate student in Electrical Engineering at Stanford How much experience did I have when I first did this material? It was difficult for me too. Started teaching in section leading program. Now I coordinate that program. We want all of you to be successful That’s why we have such a large course staff But over years and years and years we have been working on our material so that everyone gets through… Not competing against anyone but yourself. Everyone can win!

Logistics Schedule is fluid Explain purpose of lab/section. Learn by doing!!

Prerequisites Just need to know how to turn on a computer and ask for help. We love questions!!!

Course Website http://csbridge.org *note that its org not com Link to sign into lab *note that its org not com

Very High Level We will teach some specific things (Java syntax, Karel commands) but more importantly… We teach software engineering principles. Much larger than just programming. Mechanics of the language are nothing compared to the principles. You are going to learn the principles by programming in Java

Breakout demo!

Breakout Breakout demo!

What if I fall behind? First, it is okay! Everyone learns at a different pace. Ask for help.

Share Ideas Not Code

Karel Speaks Java s Karel is a gentle introduction to programming

Karel’s World North West East South 3 + + + + + 2 + + + + + 1 + + + + 4 5

Knows Four Commands move(); turnLeft(); putBeeper(); pickBeeper();

Walls + 1 2 3 4

Beepers + 1 2 3 4

move();

move(); + 1 2 3 4

move(); + 1 2 3 4 +

turnLeft();

turnLeft(); + 1 2 3 4 +

turnLeft(); + 1 2 3 4 +

pickBeeper();

pickBeeper(); + 1 2 3 4 +

pickBeeper(); + 1 2 3 4 +

Questions?

First Challenge + 1 2 3 4

First Challenge + 1 2 3 4

Need a Volunteer

Lets Try It

Anatomy of a Program import stanford.karel.*; public class OurKarelProgram extends Karel { public void run() { move(); pickBeeper(); turnLeft(); turnRight(); putBeeper(); } private void turnRight() {

This is the program's source code Anatomy of a Program import stanford.karel.*; public class OurKarelProgram extends Karel { public void run() { move(); pickBeeper(); turnLeft(); turnRight(); putBeeper(); } private void turnRight() { This is the program's source code

This piece of the program's source code is called a method. Anatomy of a Program import stanford.karel.*; public class OurKarelProgram extends Karel { public void run() { move(); pickBeeper(); turnLeft(); turnRight(); putBeeper(); } private void turnRight() { This piece of the program's source code is called a method.

This line of code gives the name of the method Anatomy of a Program import stanford.karel.*; public class OurKarelProgram extends Karel { public void run() { move(); pickBeeper(); turnLeft(); turnRight(); putBeeper(); } private void turnRight() { This line of code gives the name of the method (here, run)

This line of code gives the name of the method Anatomy of a Program import stanford.karel.*; public class OurKarelProgram extends Karel { public void run() { move(); pickBeeper(); turnLeft(); turnRight(); putBeeper(); } private void turnRight() { This line of code gives the name of the method (here, turnRight)

This is called an import statement. It tells Java what Karel is. Anatomy of a Program import stanford.karel.*; public class OurKarelProgram extends Karel { public void run() { move(); pickBeeper(); turnLeft(); turnRight(); putBeeper(); } private void turnRight() { This is called an import statement. It tells Java what Karel is.

This is called a code block Anatomy of a Program import stanford.karel.*; public class OurKarelProgram extends Karel { public void run() { move(); pickBeeper(); turnLeft(); turnRight(); putBeeper(); } private void turnRight() { This is called a code block Talk about indentation

This adds a new command to Karels vocabulary Method Definition private void name() { statements in the method body } This adds a new command to Karels vocabulary

Anatomy of a Program import stanford.karel.*; public class OurKarelProgram extends Karel { public void run() { move(); pickBeeper(); turnLeft(); turnRight(); putBeeper(); } private void turnRight() { Talk about indentation

Place 100 beeper?

For Loop for(int i = 0; i < N; i++) { // to repeat N times }

Review for(int i = 0; i < N; i++) { // to repeat N times }

Work in Any World Before After Before After What will I learn next time?

Don’t Know World Size ?