CSBridge Darafaka Lisesi. 2014 Boazii nv. 2015 Ko nv. 2016 Ko - - PowerPoint PPT Presentation

csbridge dar afaka lisesi 2014 bo azi i nv 2015 ko nv
SMART_READER_LITE
LIVE PREVIEW

CSBridge Darafaka Lisesi. 2014 Boazii nv. 2015 Ko nv. 2016 Ko - - PowerPoint PPT Presentation

CSBridge Darafaka Lisesi. 2014 Boazii nv. 2015 Ko nv. 2016 Ko nv. 2017 CTU, Czech Republic + Ko nv. 2018 Bryce Julia Asena Nick Chris Ou Our awesome 2019 2019 Ko Ko te teaching te team! Bar Pelin


slide-1
SLIDE 1

CSBridge

slide-2
SLIDE 2

Boğaziçi Ünv. 2015 Darüşşafaka

  • Lisesi. 2014

Koç Ünv. 2016 Koç Ünv. 2017 CTU, Czech Republic + Koç Ünv. 2018

slide-3
SLIDE 3

Asena Bryce Julia Nick Chris

slide-4
SLIDE 4

Ou Our awesome 2019 2019 Ko Koç te teaching te team!

slide-5
SLIDE 5

Pelin Barış

slide-6
SLIDE 6

Logistics

LOL: Lots of Labs!

Labrador Retrievers (Labs)

(computer)

slide-7
SLIDE 7

Logistics

Discussion Section

Meet your friends and talk through problems with your Section Leader!

slide-8
SLIDE 8

Stanford?

slide-9
SLIDE 9

Stanford

slide-10
SLIDE 10

Prerequisites

slide-11
SLIDE 11

http://koc.csbridge.org Course Website

*note that its or

  • rg, not co

com

slide-12
SLIDE 12

Very High Level Journey

slide-13
SLIDE 13
slide-14
SLIDE 14

Breakout

slide-15
SLIDE 15

What if I fall behind?

CS Bridge

slide-16
SLIDE 16

Share Ideas Not Code

slide-17
SLIDE 17

Questions?

slide-18
SLIDE 18

Our First Step

slide-19
SLIDE 19

Karel

slide-20
SLIDE 20

s

Karel Speaks Java

slide-21
SLIDE 21

+ + + + + + + + + + + + + + + 1 2 3 1 2 3 4 5

North South West East

Karel’s World

slide-22
SLIDE 22

+ + + + + + + + + + + + 1 2 3 1 2 3 4

Walls

slide-23
SLIDE 23

Beepers

+ + + + + + + + + + + + 1 2 3 1 2 3 4

slide-24
SLIDE 24

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

slide-25
SLIDE 25

move();

slide-26
SLIDE 26

move();

+ + + + + + + + + + + + 1 2 3 1 2 3 4

slide-27
SLIDE 27

move();

+ + + + + + + + + + + + 1 2 3 1 2 3 4 +

slide-28
SLIDE 28

turnLeft();

slide-29
SLIDE 29

turnLeft();

+ + + + + + + + + + + + 1 2 3 1 2 3 4 +

slide-30
SLIDE 30

turnLeft();

+ + + + + + + + + + + + 1 2 3 1 2 3 4 +

slide-31
SLIDE 31

pickBeeper();

slide-32
SLIDE 32

pickBeeper();

+ + + + + + + + + + + + 1 2 3 1 2 3 4 +

slide-33
SLIDE 33

pickBeeper();

+ + + + + + + + + + + + 1 2 3 1 2 3 4 +

slide-34
SLIDE 34

putBeeper();

slide-35
SLIDE 35

putBeeper();

+ + + + + + + + + + + + 1 2 3 1 2 3 4 +

slide-36
SLIDE 36

putBeeper();

+ + + + + + + + + + + + 1 2 3 1 2 3 4 +

slide-37
SLIDE 37

Questions?

slide-38
SLIDE 38

+ + + + + + + + + + + + 1 2 3 1 2 3 4

First Challenge

slide-39
SLIDE 39

+ + + + + + + + + + + + 1 2 3 1 2 3 4

First Challenge

slide-40
SLIDE 40

First Challenge

move(); turnLeft(); pickBeeper(); putBeeper();

slide-41
SLIDE 41

Need a Volunteer

slide-42
SLIDE 42

First Challenge

move(); turnLeft(); pickBeeper(); putBeeper();

slide-43
SLIDE 43

Let’s Try It

StepUp.java

slide-44
SLIDE 44

Questions?

slide-45
SLIDE 45

import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); turnLeft(); turnLeft(); turnLeft(); move(); putBeeper(); move(); } }

Improving our Program

It’s “Turn Right”, but… 🙂 not very clear 😪 tedious

slide-46
SLIDE 46

import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); // turns Karel right turnLeft(); turnLeft(); turnLeft(); move(); putBeeper(); move(); } }

Improving our Program

It’s “Turn Right”, but… descriptive comments 😪 tedious

slide-47
SLIDE 47

import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); // turns Karel right turnLeft(); turnLeft(); turnLeft(); move(); putBeeper(); move(); } }

Anatomy of a Program

This is the program's so sour urce e code de

slide-48
SLIDE 48

import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); // turns Karel right turnLeft(); turnLeft(); turnLeft(); move(); putBeeper(); move(); } }

Anatomy of a Program

This piece of the program’s so sour urce e code de is called a me method.

slide-49
SLIDE 49

import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); // turns Karel right turnLeft(); turnLeft(); turnLeft(); move(); putBeeper(); move(); } }

Anatomy of a Program

This word is the nam name of

  • ur me

method (here, run)

We must always have a run() method to run our program. But we can make an any

  • th
  • ther

er m meth thod

  • ds w

s we w e want!

slide-50
SLIDE 50

Method Definition

private void name() { statements in the method body }

T h i s a d d s a n e w c

  • m

m a n d t

  • K

a r e l ’ s v

  • c

a b u l a r y

slide-51
SLIDE 51

import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); turnRight(); move(); putBeeper(); move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

Improving our Program

Define a turnRight me method Ca Call our turnRight me method

slide-52
SLIDE 52

import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); turnRight(); move(); putBeeper(); move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

Anatomy of a Program

This is called an im import statement. It tells Java what Karel is.

slide-53
SLIDE 53

import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); turnRight(); move(); putBeeper(); move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

Anatomy of a Program

This is called a co code block.

slide-54
SLIDE 54

import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); turnRight(); move(); putBeeper(); move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

Program Style

These are terrifying!

slide-55
SLIDE 55

import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); turnRight(); move(); putBeeper(); move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

Program Style

St Style Ti Tip #1: Align braces in your code blocks.

slide-56
SLIDE 56

import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); turnRight(); move(); putBeeper(); move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

Program Style

St Style Ti Tip #1: Align braces in your code blocks.

slide-57
SLIDE 57

import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); turnRight(); move(); putBeeper(); move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

Program Style

St Style Ti Tip #1: Align braces in your code blocks.

slide-58
SLIDE 58

import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); turnRight(); move(); putBeeper(); move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

Program Style

St Style Ti Tip #2: Align indentation in your code blocks.

slide-59
SLIDE 59

import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); turnRight(); move(); putBeeper(); move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

Program Style

St Style Ti Tip #2: Align indentation in your code blocks.

slide-60
SLIDE 60

Questions?

slide-61
SLIDE 61

Place 100 beeper?

Place100.java

slide-62
SLIDE 62

For Loop

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

slide-63
SLIDE 63

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

Helper me metho thods ds for defining new commands

private void name() { statements in the method body }

fo for loops repeat code N times

Review N

slide-64
SLIDE 64

Today’s Examples on the Website

slide-65
SLIDE 65

Today’s Slides on the Website

slide-66
SLIDE 66

Your turn

x 200

(in Labs)

slide-67
SLIDE 67

Newspaper Karel

slide-68
SLIDE 68

Your turn

To the Labs!!

slide-69
SLIDE 69

Build Efes