bo azi i nv 2015 dar afaka lisesi 2014 ko nv 2016 ko nv
play

Bo azii nv. 2015 Dar afaka Lisesi. 2014 Ko nv. 2016 Ko nv. 2017 - PowerPoint PPT Presentation

Bo azii nv. 2015 Dar afaka Lisesi. 2014 Ko nv. 2016 Ko nv. 2017 Asena Bryce Julia Nick Chris Lisa Great team! Pelin Bar


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

  2. Asena Bryce Julia

  3. Nick Chris Lisa

  4. Great team!

  5. Pelin Barı ş Yazar

  6. Logistics

  7. Stanford?

  8. Stanford

  9. Prerequisites

  10. Course Website http://koc.csbridge.org *note that its org not com

  11. Very High Level

  12. Breakout

  13. What if I fall behind?

  14. Share Ideas Not Code

  15. Karel Speaks Java s

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

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

  18. Walls 3 + + + + 2 + + + + 1 + + + + 1 2 3 4

  19. Beepers 3 + + + + 2 + + + + 1 + + + + 1 2 3 4

  20. move();

  21. move(); 3 + + + + 2 + + + + 1 + + + + 1 2 3 4

  22. move(); 3 + + + + 2 + + + + 1 + + + + + 1 2 3 4

  23. turnLeft();

  24. turnLeft(); 3 + + + + 2 + + + + 1 + + + + + 1 2 3 4

  25. turnLeft(); 3 + + + + 2 + + + + 1 + + + + + 1 2 3 4

  26. pickBeeper();

  27. pickBeeper(); 3 + + + + 2 + + + + 1 + + + + + 1 2 3 4

  28. pickBeeper(); 3 + + + + 2 + + + + 1 + + + + + 1 2 3 4

  29. Questions?

  30. First Challenge 3 + + + + 2 + + + + 1 + + + + 1 2 3 4

  31. First Challenge 3 + + + + 2 + + + + 1 + + + + 1 2 3 4

  32. Need a Volunteer

  33. Lets Try It

  34. Program Style

  35. Questions?

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

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

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

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

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

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

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

  43. Method Definition private void name () { statements in the method body }

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

  45. Place 100 beeper?

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

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

  48. Work in Any World Before After After Before

  49. Don’t Know World Size ?

Recommend


More recommend