Kickoff with Karel the Robot

Jed Rembold & Fred Agbo

January 17, 2024

Announcements

  • Welcome to CS151: Intro to Programming with Python!
  • Things to do:
    • Access the course webpage on Canvas and read over the full syllabus carefully
    • Class communication/announcements: on Canvas & Discord Server. Join now!
    • Fill out the section availability form here. Last day to fill it out is Friday
    • Fill out this CS/DS/Math Program Assessment Survey here.
  • Bring phone or computer to the class for polling questions in the future
  • Watch the vidoes prepared by Professor Jed under Course Guide on Canvas and follow the instructions to:
    • setup your computer with tools needed in this class.
    • learn how to use GitHub Classroom for the homework implementation in this class
  • Homework: Problem Set 1 will be posted before the end of this week and due Jan 29 at 10pm

My Vitals

Name
Professor/Dr Fred Agbo
Office
Ford 209
Office Hours
T, TH 11:00-12:00pm
F 12:00-1:00pm
Online or anytime I’m around
Email:
fjagbo at willamette.edu
Office Phone:
503-370-6862

Motivations

  • The field of computing today is scarcely recognizable compared to the field 50 years ago.
  • Many feel the pace of the field is only accelerating as we move forwards.
  • Studying computing now lets you take part in driving forward not only the field of computing, but of all the modern fields with utilize computing.
    • Almost all fields!

How to Succeed

  • People enter this course with a variety of initial experiences
    • This course is built for an individual entering with zero coding experience
  • Path to Success
    • There is a significant time committment for this course
      • The only way to get good at coding is to do coding
      • Coding can often times involve a lot of frustrating troubleshooting or failed attempts
      • Expect, on average, the full use of WU’s 2-3 hours outside class for every hour in class
    • If you are stuck for more than 30 minutes, ask for help from your section leaders, colleagues, QUAD, or myself
      • While it is important to give yourself time to troubleshoot, when you are learning, being stuck for long leads to frustration

Squad Goals

To gain the skills, knowledge, and confidence necessary to write, test, and debug Python programs requiring several hundred lines of code.

Doing so will require that students be able to:

  • implement simple algorithms using Python control structures,
  • apply decomposition and step-wise refinement techniques,
  • design data structures to model information,
  • execute all phases of the programming process, including design, implementation, testing and debugging,

Grading

  • Standard 90/80/70 etc grade cut-offs
    • Top 2% get +’s, bottom 2% get -’s
Participation 5%
5 Problem Sets 20%
4 Defined-Projects 20%
1 Personal-Project 15%
2 Midterms 20%
A Final Exam 20%

Participation

  • Scored through participation in class polls or in contacting me with a question about a specific slide.
  • Generally 1-2 polls per day
  • Answering any poll gets you full points for the day (even if you are wrong!)
  • Answering correctly gets you bits of extra credit
  • Polling website at this link
    • Will start officially on Friday

Homework

  • Falls into two categories:
    • Problem Sets: smaller, more focused assignments
      • Graded on standard, numeric scales
    • Projects: larger, more integrative assignments
      • Graded on a more qualitative scale (next slide)
  • All will be due on Mondays at 10:00pm
  • Submissions of both will be handled through Github Classroom
    • Learn how to do this from Jed’s videos. Or meet me during my office hours if something is not working as expected!
  • 3 cumulative late days (24 hours max) over the entire semester without penalty then penalties enacted for each subsequent day late.
  • Extensions for any reason need to be requested and approved by myself before the due date

Project Sneak Peeks!

Project Scoring

  A submission so good it “makes me weep”
Exceeds requirements
  Satisfies all assignment requirements
Meets most requirements, but some issues
  Some more serious problems evident
Even worse…
  Why even bother turning this in?

Sections

  • Everyone will be placed into small sections of 8-10 students, with one section leader
  • All section leaders are students who recently took and excelled in this course
  • Will meet as a group with your section leader once a week for an hour to go over and work on problems/projects
    • These meetings will be on Mondays or Tuesdays
    • Poll out today where you can enter in your availability on these days so that we can get people placed into sections
  • Section leaders will also serve as another source you can ask for help or guidance from throughout the week
    • This tutoring is part of their job! Don’t hesitate to ask them for some extra assistance!
  • Prof. Jed is in charge of the sections and they are planning to start section meetings next week

Tests

  • Tests are necessary to assure retention of material and ensure that some are not getting too much help on the assignments.
  • Just two midterm this semester and one final:
    • Midterm 1 on Fed 23 (in-class, use of computer, partially open)
    • Midterm 2 on March 22 (take-home, use computer, totally open)
    • Final on May 6/7. See this calendar to confirm your exact date. (in-class, use of computer, partially open)
  • This policy has actually been seen to improve student scores, as it prevents you from wasting tons of time obsessing about a small mistake!
  • Example tests and study materials will be given out in advance.

Communication

  • I have had much better luck recently channeling class communication (announcements, questions, answers, etc) through a class Discord server and on Canvas
    • Invite instructions are posted on the main Canvas landing page and on the second slides for this class
    • Totally free to sign up and use Discord
    • If you already use Discord, you can create another account to switch between, or you can use your existing account
  • Both Canvas and Discord will be the main online location for announcements and questions and answers.
  • Discord has support for code-blocks when talking about code by surrounding code in triple backticks: ```this is formatted nicely as code```

Academic Honesty

  1. You must not look at solutions or program code that is not your own.
  2. You must not share your solution code with other students.
    • But you are welcome (and encouraged!) to work alongside others enroute to finding a solution.
  3. You must indicate on your submitted assignment any assistance you received or who you worked alongside.

Diving In

  • This course is an introduction on computer science, and covers more than just programming!
  • Python is used to teach the programming portion of the course, but the focus is less on Python itself and more on general computer science principles.
  • If you come across situations where you need to know a bit more about specific Python details, there are plenty of resources online, or just ask me!

Effective Communication

  • To communicate effectively with someone or something, you really need two layers of communication:
    • A shared language or method of conveying information
      • The English alphabet, for example
      • In our case, Python
    • A joint agreement about what constitutes meaning
      • Need ways to limit confusion or misunderstanding
        • Following conventions
      • Being able to explain things clearly and unambiguously

Giving Clear Instructions

  • We will initially make the language extremely simple so that we can focus on the second layer
  • Karel the Robot exists in a very simple 2D world
  • Has a very limited set of actions:
    • Can move forward one space
    • Can rotate counter-clockwise (turn left) 90 degrees
    • Can pick up a beeper
    • Can drop off a beeper
  • We will be spending the first several class days just interested in how we can take these simple instructions and get Karel to solve a wide variety of problems
    • This content is not in your book, but more in-depth descriptions can be found here

The World

  • Karel’s world is defined on a grid
    • avenues run north-south
    • streets run east-west
    • The intersection between a street and avenue is called a corner
  • Compass directions are as you’d have them on a map, with North pointing upwards
  • Walls are impassable
  • Beepers are diamonds
  • Karel is a house-shaped polygon

Commands

  • As we mentioned before, Karel is a simple robot, and can really only do 4 potential actions

    Command Action
    move() Moves Karel forward one corner in whatever direction they are facing
    turn_left() Rotates Karel 90 deg counter-clockwise
    pick_beeper() Picks up a beeper on the ground
    put_beeper() Places a beeper on the ground
  • Our commands are just sequences of these actions

Example

  • Suppose we had the situation to the right and wanted to navigate to the beeper, pick it up, and then drop it at the corner of 1st avenue and 1st street.
  • Take a moment to write out your instructions.
    • Remember you can only move, rotate left, and pick up or drop the beeper
  • Note that there are multiple ways to do this! Which is better?

One Solution

def main():
    move()
    turn_left()
    turn_left()
    turn_left()
    move()
    turn_left()
    move()
    turn_left()
    turn_left()
    turn_left()
    move()
    pick_beeper()
    turn_left()
    turn_left()
    turn_left()
    move()
    move()
    put_beeper()
// reveal.js plugins