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

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


  1. CSBridge

  2. Darüşşafaka Lisesi. 2014 Boğaziçi Ünv. 2015 Koç Ünv. 2016 Koç Ünv. 2017 CTU, Czech Republic + Koç Ünv. 2018

  3. Bryce Julia Asena Nick Chris

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

  5. Barış Pelin

  6. Logistics (computer) LOL: Lots of Labs! Labrador Retrievers (Labs)

  7. Logistics Discussion Section Meet your friends and talk through problems with your Section Leader!

  8. Stanford?

  9. Stanford

  10. Prerequisites

  11. Course Website http://koc.csbridge.org *note that its or org , not co com

  12. Very High Level Journey

  13. Breakout

  14. What if I fall behind? CS Bridge

  15. Share Ideas Not Code

  16. Questions?

  17. Our First Step

  18. Karel

  19. Karel Speaks Java s

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

  21. Walls 3 + + + + 2 + + + + 1 + + + + 1 2 3 4

  22. Beepers 3 + + + + 2 + + + + 1 + + + + 1 2 3 4

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

  24. move();

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

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

  27. turnLeft();

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

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

  30. pickBeeper();

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

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

  33. putBeeper();

  34. putBeeper(); 3 + + + + 2 + + + + 1 + + + + + 1 2 3 4

  35. putBeeper(); 3 + + + + 2 + + + + 1 + + + + + 1 2 3 4

  36. Questions?

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

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

  39. First Challenge move(); pickBeeper(); turnLeft(); putBeeper();

  40. Need a Volunteer

  41. First Challenge move(); pickBeeper(); turnLeft(); putBeeper();

  42. Let’s Try It StepUp.java

  43. Questions?

  44. Improving our Program import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); It’s “Turn Right”, but… move(); 🙂 not very clear turnLeft(); turnLeft(); 😪 tedious turnLeft(); move(); putBeeper(); move(); } }

  45. Improving our Program import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); // turns Karel right turnLeft(); turnLeft(); turnLeft(); move(); It’s “Turn Right”, but… putBeeper(); move(); descriptive comments } 😪 tedious }

  46. Anatomy of a Program import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); This is the // turns Karel right program's turnLeft(); sour so urce e code de turnLeft(); turnLeft(); move(); putBeeper(); move(); } }

  47. Anatomy of a Program import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); This piece of the // turns Karel right turnLeft(); program’s so sour urce e code de is turnLeft(); called a me method . turnLeft(); move(); putBeeper(); move(); } }

  48. Anatomy of a Program import stanford.karel.*; public class StepUp extends Karel { public void run() { name of This word is the nam move(); pickBeeper(); method (here, run) our me turnLeft(); move(); // turns Karel right turnLeft(); turnLeft(); We must always have a run() turnLeft(); method to run our program. move(); putBeeper(); move(); But we can make an any } oth other er m meth thod ods w s we w e want ! }

  49. Method Definition private void name () { statements in the method body } w e n a s s d ’ l e d r a a s K i h o T t d n a y m r a m l u o b c a c o v

  50. Improving our Program import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); Call our turnRight me Ca method move(); turnRight(); move(); putBeeper(); move(); } private void turnRight() { turnLeft(); Define a turnRight turnLeft(); me method turnLeft(); } }

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

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

  53. Program Style import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); These are turnLeft(); terrifying! move(); turnRight(); move(); putBeeper(); move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

  54. Program Style import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); Style Ti St Tip #1 : turnLeft(); Align braces in move(); turnRight(); your code blocks. move(); putBeeper(); move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

  55. Program Style import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); Style Ti St Tip #1 : turnLeft(); Align braces in move(); turnRight(); your code blocks. move(); putBeeper(); move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

  56. Program Style import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); Style Ti St Tip #1 : turnLeft(); Align braces in move(); turnRight(); your code blocks. move(); putBeeper(); move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

  57. Program Style import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); Style Ti St Tip #2 : turnRight(); move(); Align indentation putBeeper(); in your code blocks. move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

  58. Program Style import stanford.karel.*; public class StepUp extends Karel { public void run() { move(); pickBeeper(); turnLeft(); move(); Style Ti St Tip #2 : turnRight(); move(); Align indentation putBeeper(); in your code blocks. move(); } private void turnRight() { turnLeft(); turnLeft(); turnLeft(); } }

  59. Questions?

  60. Place 100 beeper? Place100.java

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

  62. Review Helper me ds for defining new commands metho thods private void name () { statements in the method body } for loops repeat code N times fo N for (int i = 0; i < N ; i++) { // to repeat N times }

  63. Today’s Examples on the Website

  64. Today’s Slides on the Website

  65. Your turn x 200 (in Labs)

  66. Newspaper Karel

  67. Your turn To the Labs!!

  68. Build Efes

Recommend


More recommend