1 / 46

Computer Bugs

Computer Bugs. Jon. Original Powerpoint By: Spring LIS4480 Coding Team. Why Coding?. http://www.youtube.com/watch?v=nKIu9yen5nc. PB&J Programming. Instructions. Work with your group Write instructions for how to make a peanut-butter and jelly sandwich. PB&J Program.

onawa
Download Presentation

Computer Bugs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Bugs Jon Original Powerpoint By: Spring LIS4480 Coding Team

  2. Why Coding? http://www.youtube.com/watch?v=nKIu9yen5nc

  3. PB&J Programming

  4. Instructions • Work with your group • Write instructions for how to make a peanut-butter and jelly sandwich

  5. PB&J Program • Take a slice of bread • If the jar is not open, • Open the jar of peanut butter by twisting the lid counter clockwise • Pick up a knife by the handle • Insert the knife into the jar of peanut butter • Withdraw the knife from the jar of peanut butter and run it across the slice of bread • Take a second slice of bread • Repeat steps 2-5 with the second slice of bread and the jar of jelly • Press the two slices of bread together such that the peanut butter and jelly meet

  6. Download Hackety!http://goo.gl/PPyvA Michael

  7. alert “Hello world!” What happens if we type this and hit run?

  8. alert • Displays a window • “Hello world!” • Is a string • Think of it as a “string” of letters

  9. name = ask “What is your name?” alert “Hello “ + name What is different?

  10. name • Variable • Or nickname • ask • Displays a window with a text box

  11. write a program that tells a joke

  12. PB&J • Take a slice of bread • If the jar is not open, • Open the jar of peanut butter by twisting the lid counter clockwise • Pick up a knife by the handle • Insert the knife into the jar of peanut butter • Withdraw the knife from the jar of peanut butter and run it across the slice of bread • Take a second slice of bread • Repeat steps 2-5 with the second slice of bread and the jar of jelly • Press the two slices of bread together such that the peanut butter and jelly meet

  13. answer = ask “Is the jar open?” if answer == “No” alert “Open the jar.“ end Try answering with “No” and “no”. What is different?

  14. answer = ask “Is the jar open?” if answer == “No” alert “Open the jar.“ end We’re asking ifansweris equal to“No”.

  15. answer = ask “Is the jar open?” if answer == “No” alert “Open the jar.“ end We’re asking if answer is equal to“No”.

  16. answer = ask “Is the jar open?” if answer == “No” alert “Open the jar.“ else alert “Do not open the jar.“ end We can also tell the computer to do something else.

  17. answer = ask “Is the jar open?” if answer == “No” alert “Open the jar.“ else alert “Do not open the jar.“ end Try answering with “Yes” and “No”. What is different?

  18. Write a guessing game Aaron

  19. secret =42.to_s guess = ask “What is the secret?” Complete the program.

  20. secret =42.to_s guess = ask “What is the secret?” if guess == secret alert “Correct!“ else alert “Wrong!“ end Completed program.

  21. alert 1 alert 1 + 1 alert 4 - 1 alert 8 / 2 alert 5 * 1 We can tell the computer to do math too

  22. alert 1 alert 2 alert 3 Display the numbers 1, 2, 3

  23. alert 1 alert 2 alert 3 alert 4 alert 5 alert 6 alert 7 alert 8 alert 9 What if we wanted to count higher?

  24. alert1 alert2 alert3 alert4 alert5 alert6 alert7 alert8 alert9 What if we wanted to count higher?

  25. number= 1 9.times do alert number number = number +1 end Does the same thing as before!

  26. number= 1 9.times do alert number number = number + 1 end Make number=1

  27. number= 1 9.times do alert number number = number + 1 end do stuff until end9times

  28. number = 1 9.times do alert number number = number +1 end do stuff 9 times, end

  29. number= 1 9.times do alert number number = number +1 end Does the same thing as before!

  30. secret =42.to_s guess = ask “What is the secret?” if guess == secret alert “Correct!“ else alert “Wrong!“ end Can you change the code to ask “What is the secret?”3times?

  31. secret =42.to_s 3.times do guess = ask “What is the secret? You get 3 guesses!” end if guess == secret alert “Correct!“ else alert “Wrong!“ end Why does the program keep asking if we guess correctly?

  32. secret =42.to_s 3.times do guess = ask “What is the secret? You get 3 guesses!” if guess == secret break end end if guess == secret alert “Correct!“ else alert “Wrong!“ end We need to tell the computer to break, or stop, if the guess is correct.

  33. Let’s meet Turtle …not these turtles http://www.youtube.com/watch?v=CMNry4PE93Y Michael

  34. Turtle.startdo end What happens if you run this program?

  35. Turtle.startdo forward 100 end We need to tell Turtle to do something.

  36. Turtle.startdo turnright90 end What does turnright90 do?

  37. Turtle.startdo forward 100 turnright90 forward 100 end We can combine directions. Can you make Turtle draw a square?

  38. Turtle.startdo forward 100 turnright90 forward 100 turnright90 forward 100 turnright90 forward 100 turnright90 end

  39. Turtle.startdo 4.times do forward 100 turnright90 end end With a loop things get easier!

  40. Can you make Turtle draw an octagon?

  41. Turtle.startdo 8.times do forward 100 turnright45 end end

  42. Turtle.startdo background darkred pencolor gold 8.times do forward 100 turnright45 end end We can change the color of the background and the pencolor.

  43. http://shoesrb.com/manual/Colors.html

  44. Code this and customize it! Have fun and be creative! Harrison

  45. Creative Contest Draw something using turtle. Don’t be afraid to ask for help! Skittles?

  46. Conclusion • We hope you enjoyed the lessons please let us know what you learned in the survey! • If time is permitting let’s make something! • P.S. We are getting graded on this

More Related