1 / 41

EECS 110: Lec 2: What is Programming?

EECS 110: Lec 2: What is Programming?. Aleksandar Kuzmanovic Northwestern University. http://networks.cs.northwestern.edu/EECS110-s18/. Grading. Grades. if perc >= .90: grade = 'A' elif perc >= .80: grade = ‘B' elif perc >= .70: grade = 'C'. Based on points percentage. ~ 75% Assignments.

morelj
Télécharger la présentation

EECS 110: Lec 2: What is Programming?

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. EECS 110: Lec 2: What is Programming? Aleksandar Kuzmanovic Northwestern University http://networks.cs.northwestern.edu/EECS110-s18/

  2. Grading Grades if perc >= .90: grade = 'A' elif perc >= .80: grade = ‘B' elif perc >= .70: grade = 'C' Based on points percentage ~ 75% Assignments ~ 25% Exams Extra ~ 5% Participation Midterm Wed May 2 Exams Final Wed June 6 To pass EECS 110, you must have a passing grade on both the exams and HW. I will also give quizzes in the class, but they will not be graded. Note!

  3. Getting help! • Labs • You should attend the labs because they will have you solve about 50% of your homework • Recitations • There will be a recitation class each Friday (10-10:50 am): help with the rest 50% of the homework • Office Hours • TA1: Friday 1-3 pm (Wilkinson). • TA2: Sunday 3-5 pm (Wilkinson) • Professor: Tuesday: 10-11am (Wilkinson).

  4. Communication • Professor: • akuzma@northwestern.edu • TAs: • Ibrahim Poyraz, emirhan@u.northwestern.edu • Majed Beigi, majed.beigi@northwestern.edu • Matthew Niemer, MatthewNiemer2018@u.northwestern.edu • Matthew Nicholson, MatthewNicholson2019@u.northwestern.edu • Thomas Sieben, ThomasSieben2019@u.northwestern.edu • Gino Wang, SihengWang2019@u.northwestern.edu • MaulinHemani, MaulinHemani2018@u.northwestern.edu • Group e-mail: via Canvas

  5. Teaching Assistants Ibrahim Poyraz Majed Beigi

  6. Matthews Matthew Niemar Matthew Nicholson

  7. Teaching Assistants Thomas Sieben Maulin Hemani

  8. Teaching Assistants Gino Wang

  9. Homework Assignments ~ 4-5 problems/week ~ 100 points 20-25% extra credit available Due Sunday evening - by 11:59 pm. You can submit 3 homeworks 1 day later "Late Days" Some problems are specified “individual-only.” Others offer the option of working in a pair. Collaboration • You must share the work equally - typing and coaching • Each of you should make ONE submission (2 per team) • Be sure to indicate who your partner was at the submission site! Honor Code

  10. Honor Code • You may not share written, electronic or verbal solutions with other students (present or past): • You are encouraged to discuss problems with other students, TAs, or instructors. • You may not share written, electronic or verbal solutions with other students (present or past): • Copying of files except those provided by the course material. You will have the option of working in pairs for MANY of each week’s problems: the same guidelines apply for each pair.

  11. Book • CS for Scientists and Engineers, by C. Alvarado, Z. Dodds, G. Kuenning, and R. Libeskind-Hadas (Note: this is a preliminary draft!) •  Available at: http://networks.cs.northwestern.edu/EECS110-s18/cs5book.pdf • (there is a direct link from the documentation page) •  The book is recommended, but NOT required

  12. Software and Web site • Web page: http://networks.cs.northwestern.edu/EECS110-s18/ • Programs: Python and Idle open source, free from www.python.org installation instructions on the Web site MAKE SURE TO DOWNLOAD python-3.5.1

  13. Submission site https://canvas.northwestern.edu Problems/issues: emirhan@u.northwestern.edu majed.beigi@northwestern.edu

  14. Homework problems 3 and 4 walls Picobot Picobot area not covered (yet!) area already covered Goal: whole-environment coverage with only local sensing… inspiration?

  15. Picobot walls Picobot area not covered (yet!) area already covered Goal: whole-environment coverage with only local sensing… iRobot's Roomba vacuum inspiration!

  16. Surroundings Picobot can only sense things directly to the N, E, W, and S N E W S For example, here its surroundings are NxWx Surroundings are always in NEWS order. N E W S

  17. Surroundings How many distinct surroundings are there? N E W S 24 == 16 possible … xxxx Nxxx xExx xxWx xxxS NExx NxWx NxxS xEWx xExS xxWS NEWx NExS NxWS xEWS NEWS (won’t happen)

  18. State I am in state 0. My surroundings are xxWS. Picobot's memory is a single number, called its state. State is the internal context of computation. Picobot always starts in state0. State and surroundings represent everything the robot knows about the world

  19. Rules I am in state 0. My surroundings are xxWS. Aha! I should move N. I should enter state 0. Picobot moves according to a set of rules: state surroundings direction new state 0 xxWS N 0 If I'm in state 0 seeing xxWS, Then I move North, and change to state 0.

  20. Wildcards I am in state 0. My surroundings are xxWS. Aha! This matches x*** Asterisks * are wild cards. They match walls or empty space: state surroundings direction new state 0 x*** N 0 here, EWS may be wall or empty space

  21. What will this set of rules do to Picobot? state surroundings direction new state 0 x*** N 0 -> 0 N*** -> X 1 -> 1 ***x S 1 -> 1 ***S X 0 Picobot checks its rules from the top each time. When it finds a matching rule, that rule runs. Only one rule is allowed per state and surroundings.

  22. To do Write rules that will always cover these two rooms. (separate sets of rules are encouraged…) hw0, Problem #3 hw0, Problem #4 (Extra) but your rules should work regardless of Picobot's starting location

  23. Alter these "up & down" rules so that Picobot will traverse the empty room… the empty room

  24. Ideas for the maze? the maze

  25. Python and Idle Editor window: code Shell window: running code Here, you can save and change programs. Hitting F5 runs your program over in the shell Here, you can try things out at the command prompt >>>

  26. If statements (1) name = input('Hi... what is your name?') if name == ’Ning': # is it Ning? print('x1’) else: # in all other cases... print('x2’) print('x3’) hw0pr1.py Homework 0, problem 1

  27. If statements (2) name = input('Hi... what is your name?') if name == ’Ning‘: print('x1’) else: print('x2’) print('x3’)

  28. CS != programming What is computer science (CS)? Take EECS 101

  29. CS != programming What is computer science (CS)? Take EECS 101 "not equal to"

  30. CS != programming programming : CS :: machining : engineering grammar : literature Programming equations : mathematics CS a vehicle, not a destination

  31. CS ==computingscience Study of complexity (or complex things?) How can it be done? How well can it be done? Can it be done at all?

  32. CS ==computingscience Study of complexity (or complex things?) How can it be done? How well can it be done? Can it be done at all? "equal to"

  33. Information What information does Google work with? What technical problems does Google face?

  34. Information What information does Facebook work with? What technical problems does Facebook face?

  35. Information What information does the iPhone work with? What technical problems does the iPhone face?

  36. Computer Science and Information • Information is life’s fundamental building block • CS is a set of fundamental techniques for understanding and leveraging this information

  37. What is programming? Programming as learning a foreign language 1) Expect it to be different! 2) Don’t feel you need to memorize it 3) Immersion == Experimentation

  38. The foreign language of Python… syntax? semantics? intent? How it looks What it does What it should do name = input('Hi... what is your name?') print# prints a blank line if name == ’Ning': # is it Ning? print( name, '??’) print(‘You must be a TA!') elif name == ‘Aleksandar’: # is it Aleksandar? print( ‘You must be an instructor!') else: # in all other cases... print( 'Welcome to Python,', name, '!')

  39. The foreign language of Python… syntax? semantics? intent? How it looks What it does What it should do name = input('Hi... what is your name?') print# prints a blank line if name == ’Ning': # is it Ning? print( name, '??’) print(‘You must be a TA!') elif name == ‘Aleksandar’: # is it Aleksandar? print( ‘You must be an instructor!') else: # in all other cases... print( 'Welcome to Python,', name, '!')

  40. The foreign language of Python syntax? semantics? intent? How it looks What it does What it should do • how punctuation is used • the language keywords that are used • use of whitespace • peculiarities of formatting • how behavior is affected …

  41. HW 0, Problem 2 syntax? semantics? intent? How it looks What it does What it should do • Save hw0pr1.py under a new name, hw0pr2.py • Change hw0pr2.py to play rock-paper-scissors. It does not have to play fair! Feel free to add to the dialog, if you wish… • Submit your hw0pr2.py in the usual way. Stepping back from Python for a moment…

More Related