COS 100: Class Sessions and Assignments
COURSE INDEX
Week 1
Introductory Concepts and Materials
Weeks 2-5
Scratch Programming
Weeks 6-9
Option 1 – Python Programming – Finch Robot
Option 2 – Python Programming – Programming a Crane
Weeks 10-13
Option 1 – Programming Robots
Option 2 – Sensors and Databases
Option 3 – Drones and Imagery Data
Option 4 – GIS Database Development
Option 5 – Virtual Reality Visualizations
Weeks 14-15
Final Prototype Project Team Work
DETAILED COURSE SCHEDULE
Week 1: INTRODUCTORY CONCEPTS AND MATERIALS
1. INITIAL SETUP
Communications
Communications among the class and among teams will occur through the use of Slack Team Messaging. The course site is at *insert Slack URL*. You will receive an invitation to join through your email address. You should also download the Slack App for your computer and the Slack App for your smart phone (if you have one). This will allow quick messages from your self-selected course slack teams to pop up on your device. This software is popular with code development team members in the commercial sector.
Blog Requirements
A blog entry needs to be entered at least once per week prior to 8:00 pm on Sunday evening. See the Blog Handout that includes instructions on how to set it up and the grading rubric for blog posts. The only person reading your Blog Posts will be the lead instructor who will regularly respond to them. The purpose of the blog readings and videos is often to expose students to broader computing concepts than covered by the coding exercises.
1. SCHEDULE & BLOG ASSIGNMENTS
Week 1 Tuesday |
|
Week 1 Thursday |
|
Weeks 2 – 5: SCRATCH PROGRAMMING
1. MATERIALS & READINGS
Primary tutorial materials: http://scratch.mit.edu (e.g. https://scratch.mit.edu/help/, https://scratch.mit.edu/help/videos/, Hour of Code – https://scratch.mit.edu/hoc/)
Exercises
The following worksheets were acquired from http://scratched.gse.harvard.edu/ Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab and is available under a Creative Commons Attribution-ShareAlike license. This means that the Harvard pages and these UMaine pages building from the MIT pages are available under the same license terms.
ALL WORKSHEETS (single combined pdf file)
Worksheet #1 Set up Scratch Account
Worksheet #2 Scratch Explore
Worksheet #3 Scratch Studio
Worksheet #4 Step by Step
Worksheet #5 10 blocks
Worksheet #6 About Me
Worksheet #7 Scratch Sound
Worksheet #8 Orange Purple
Worksheet #9 It’s Alive
Worksheet #10 Adding Sound files
Worksheet #11 Characters
Worksheet #12 Scenes
Worksheet #13 Remix
Worksheet #14 Maze
Worksheet #15 Pong
Worksheet #16 Scrolling
Worksheet #17 Score
Worksheet #18 Extending
Resources
Consult the following when referred to in the Schedule and Blog Assignments.
Some Needed Graphics Files for Exercises
Supplemental Readings and Resources
Find on the web and explore at least three additional Scratch tutorials or help sites.
Examples:
- Search youtube.com for Scratch tutorials.
- Scratch Programming Lesson 1x at scratched.gse.harvard.edu/sites/default/files/learn-scratch-lesson-1.pdf
- http://www.funlearning.de/ <click on English>
These suggested sites are only illustrative. If you do not find specific information you need or desire, search the web further.
2. SCHEDULE & BLOG ASSIGNMENTS
Week 2 Tuesday |
|
Week 2 Thursday |
|
Week 3 Tuesday |
|
Week 3 Thursday |
|
Week 4 Tuesday |
|
Week 4 Thursday |
|
Week 5 Tuesday |
|
Week 5 Thursday |
|
3. TWO-WEEK PROJECT ASSIGNMENTS
Scratch Team Project Assignment 1 (due at end of Week 3) – Interactive Advertisement, Interactive Instructional Materials or Interactive Display (pdf version)
Your team should choose one of the following tasks that you will execute using Scratch:
- Create an interactive advertisement for a local nonprofit organization of your choice.
- Think of a class you have enjoyed and construct interactive instructional material for the class.
- Tourism Maine has a competition for interactive displays of parks in Maine. As part of the competition for the contract, provide a short example of material to be included in a beaches of Maine entry.
Rules
Your project should include the following:
- At least 3 different characters (sprites).
- At least three different background objects in the scenery for your program.
Your code should include:
- At least two uses of operators.
- At least two forever if loop or forever statements.
- At least two If/Else Statements.
- Have at least one sprite associated with sound.
- Have comments in the code so others can understand what the code does.
Some of the sprites should be able to respond to commands by users, associated with clicks on the keyboard, when the mouse is clicked on an object on the screen, OR when a variable changes. Include at least one of each of these commands in your program. Explain the function of each command in a comment at the beginning of the program execution.
Optional
Create a storyboard (storyboards are used when planning movies, advertisements, cartoon books, and hence are also useful for this exercise. It consists of a series of cartoons images on a page depicting your plan for each scene). Feel free to bring your storyboard to class prior to submission to brainstorm with the rest of us about your project and your approach. Bring the project to class (on a usb stick) on the day it is due and be ready to present it to the class.
Grading: Late project submissions result in lowering of a full grade per week. A program that is off topic will acquire at most a B-.
Rubric
Grade | Performance |
A | All parts are present: Program with all elements and comments. Program works flawlessly under all scenarios. |
B | Missing some critical elements. Program mostly works. |
C | Missing several critical elements. Program works ~ 50% of the time. |
D | Missing most critical elements. Program mostly does not work. |
F | No project turned in within two weeks of the deadline. |
Scratch Team Project Assignment 2 (due at end of week 5) – Scratch Arcade Games (pdf version)
Your team should choose from among one of the following three arcade games to program.
i. Frogger
The game starts with three, five, or seven frogs (lives), depending on the settings used by the operator. The player guides a frog which starts at the bottom of the screen, to his home in one of 5 slots at the top of the screen. The lower half of the screen contains a road with motor vehicles, which in various versions include cars, trucks, buses, dune buggies, bulldozers, vans, taxis, bicyclists, and/or motorcycles, speeding along it horizontally. The upper half of the screen consists of a river with logs, alligators, and turtles, all moving horizontally across the screen. The very top of the screen contains five “frog homes” which are the destinations for each frog. Every level is timed (1 minute); the player must act quickly to finish each level before the time expires.
The only player control is the 4 direction joystick used to navigate the frog; each push in a direction causes the frog to hop once in that direction. On the bottom half of the screen, the player must successfully guide the frog between opposing lanes of trucks, cars, and other vehicles, to avoid becoming roadkill.
The middle of the screen, after the road, contains a median where the player must prepare to navigate the river.
By jumping on swiftly moving logs and the backs of turtles and alligators except the alligator jaws, the player can guide his or her frog safely to one of the empty lily pads. The player must avoid alligators sticking out at one of the five “frog homes”, snakes, and otters in the river, but may catch bugs or escort a lady frog for bonuses. When all five frogs are directed home, the game progresses to the next level, with increased difficulty. After five levels, the game gets briefly easier yet again gets progressively harder to the next fifth level.
http://www.witty.ca/scratch-2—frogger-p1.html
ii. Super Mario
The game world has coins scattered around it for Mario to collect, and special bricks marked with a question mark (?), which when hit from below by Mario, may reveal more coins or a special item. Other “secret”, often invisible, bricks may contain more coins or rare items. If the player gains a red and yellow Super Mushroom, Mario grows to double his size and can take one extra hit from most enemies and obstacles, in addition to being able to break bricks above him.[7]:12 Players are given a certain number of lives, and may gain additional lives by picking up green and orange 1-Up mushrooms, collecting 100 coins, defeating several enemies in a row with a Koopa shell, or bouncing on enemies successively without touching the ground. One life is lost when Mario takes damage while small, falls in a pit, or runs out of time. The game ends when all lives are lost.
iii. Pacman
The player controls a circular character which has a pie wedge shaped mouth to eat pellets through a maze, eating Pac-Dots. When all dots are eaten, Pac-Man is taken to the next stage. Four ghosts, Blinky, Pinky, Inky and Clyde roam the maze, trying to catch Pac-Man. If a ghost chomps (touches) Pac-Man, a life is lost. When all lives have been lost, the game ends. Pac-Man is awarded a single bonus life at 10,000 points by default–DIP switches inside the machine can change the required points or disable the bonus life altogether.
Game Construction Rules
- Your project should include at least four variations of sprites.
- Use at least 5 different control blocks, 3 different sensing blocks, 2 variables and 2 operators.
- Some objects detect when colliding with other objects. Sidewalls should be such that Objects leaving on the right re-enter to the left of the screen and vice-versa
- Game should allow for user to have a set of lives to complete game.
- Game should use a random number generator to very movement of objects.
- Game should have a fun factor associated with it.
Submit the project to the course scratch website on the day it is due and be ready to present it to the class.
Grading: Late project submissions result in lowering of full grade per week.
Rubric
Grade | Performance |
A | All the above details are present, clear to the user, and working (A- if minor details missing). |
B | Most of the above details are present, mostly clear to the user, and mostly working. |
C | About half of the above details are present, or are clear to the user, or are working. |
D | A few of the above details are present, or are clear to the user, or are working. |
F | No project turned in within two weeks of the deadline. |
[OPTION 1] Weeks 6 – 9: PYTHON PROGRAMMING – PROGRAMMING WITH FINCH ROBOT (recommended python programming option.)
Week-long version (zip)
1. MATERIALS & READINGS
Instructions for installing Python and setting up Finch Robot Software:
1.1 Readings
- Using IDLE (pdf)
- Programming Concepts (pdf)
- Hello, World and Variables (pdf)
- Movement and Other Output (pdf)
- Text Input and Conditionals (pdf)
- Responding to the Environment (pdf)
- Loops and Flags (pdf)
- Continuous Behaviour (pdf)
- Functions (pdf)
- Using Functions: Navigation (pdf)
1.2. Videos
- Computer science is for everyone (10:32): https://www.youtube.com/watch?v=FpMNs7H24X0
- You Should Learn to Program: Christian Genco at TEDxSMU (10:25): https://www.youtube.com/watch?v=xfBWk4nw440
- How Can I Become a Good Programmer (9:33): https://www.youtube.com/watch?v=BjKmWk3oE4E
- The Fundamentals of Writing Computer Programming (5:52): https://www.youtube.com/watch?v=YCDTYlUWkQE
- Why You Should Learn Python Programming (10:49): https://www.youtube.com/watch?v=G8brQdClo9s
- The Rise of Personal Robots (13:56): https://www.ted.com/talks/cynthia_breazeal_the_rise_of_personal_robots
- How Arduino is Open-sourcing Imagination (15:46): https://www.ted.com/talks/massimo_banzi_how_arduino_is_open_sourcing_imagination
- No Roads? There’s a Drone For That (9:13): https://www.ted.com/talks/andreas_raptopoulos_no_roads_there_s_a_drone_for_that
- How to Fool a GPS (15:45): https://www.ted.com/talks/todd_humphreys_how_to_fool_a_gps
- This Virtual Lab Will Revolutionize the Science Class (11:26): https://www.ted.com/talks/michael_bodekaer_this_virtual_lab_will_revolutionize_science_class
1.3 Supplemental Reading and Resources
- “Managed Coder: Advice to a New Programmer” : http://www.codemag.com/Article/1105121
- “10 tips to go from a beginner to an intermediate programmer” : http://www.techrepublic.com/blog/software-engineer/10-tips-to-go-from-a-beginner-to-an-intermediate-developer/
- Guide to Python (pdf)
- Codecademy: https://www.codecademy.com/learn/python
- Khan Academy: https://www.khanacademy.org/computing/computer-science/algorithms
- Code.org: https://code.org
1.4 Worksheets
- Worksheet 1 (pdf)
- Worksheet 2 (pdf)
- Worksheet 3 (pdf)
- Worksheet 4 (pdf)
- Worksheet 5 (pdf)
- Worksheet 6 (pdf)
- Worksheet 7 (pdf)
2. SCHEDULE & BLOG ASSIGNMENTS
Week 6 Tuesday |
|
Week 6 Thursday |
|
Week 7 Tuesday |
|
Week 7 Thursday |
|
Week 8 Tuesday |
|
Week 8 Thursday |
|
Week 9 Tuesday |
|
Week 9 Thursday |
|
3. TWO-WEEK PROJECT ASSIGNMENTS (due at end of Week 9)
Option 1: Stay in the Light
Setup: Turn out the lights in the room. Using flashlights, computer screens, and other lights sources, create patches of light throughout the room.
Task: Create a program that does the following:
- When the Finch is in the light, turns the LED nose green,
- When the Finch is in the darkness, turns the LED nose red,
- If the Finch is in darkness, finds another source of light.
Option 2: Stay out of the Light
Setup: Turn the lights out in the room. Give students flashlights.
Task: Create a program that does the following:
- When the Finch is in the darkness, turn the LED nose green,
- When the Finch is in the light, turn the LED nose red,
- If the Finch is in the light, the Finch runs away from the light.
Option 3: Race to the Finish
Setup: Create a small race track using books and other obstacles.
Task: Create a program that does the following:
- Plays three sounds in ascending frequency,
- At the end of the last sound, takes off on the race course,
- When the Finch detects an obstacle, backtracks and tries another route,
- When the Finch is tapped, plays a victory jingle and stops.
Option 4: Escape the Maze
Setup: Create a maze using books and other obstacles.
Task: Create a program that makes the Finch navigate the maze.
Grading: Late project submissions result in lowering of a full grade per week. A program that is off topic will acquire at most a B-
Rubric
Grade | Performance |
A | All parts are present: Program with all elements and comments. Program works flawlessly under all scenarios. |
B | Missing some critical elements. Program mostly works. |
C | Missing several critical elements. Program works ~ 50% of the time. |
D | Missing most critical elements. Program mostly does not work. |
F | No project turned in within two weeks of the deadline. |
[OPTION 2] Weeks 6 – 9: PYTHON PROGRAMMING – PROGRAMMING A CRANE (pdf version)
1. MATERIALS & READINGS
We will by using the GlowScript environment. No installation is necessary, it runs in a web browser and can be accessed at www.glowscript.org. You need to sign in using a Google account.
- After successfully signing in, you should see the sentence “You are signed in as <yourusername> and your programs are here.” Click on here.
- Click on Create New Program. Name it “box”. Below the line Glowscript 2.1 VPython type “box()”
- Then click on Run this program. You will see a white box on a black background.
- Use the right button (or CTRL-drag left button) of the mouse to rotate the camera to view the scene from different angles.
- To zoom in and out use the two buttons, or ALT/OPTION-drag, or the mouse scroll wheel.
Touch screen: swipe or two-finger rotate; pinch/extend to zoom. - Click on Help to see what graphical objects are available.
Video Instructions on Installing Python on your Computer
• Mac: https://www.youtube.com/watch?v=99o_WDjjuv8 (11 min)
• Windows: https://www.youtube.com/watch?v=M4ztKyNkDIM (4:30 min)
Videos on Using the Interpreter and Writing Programs
• https://www.youtube.com/watch?v=a6T4S3vkD-I&list=PL6lxxT7IdTxFKo9DguLxGM2dhgb8-u976&index=2
• https://www.youtube.com/watch?v=TksMgR2qpJs&index=3&list=PL6lxxT7IdTxFKo9DguLxGM2dhgb8-u976
Videos on Installing and Getting Started with PyCharm
• https://www.youtube.com/watch?v=Ejrq3yB2DIQ
• https://www.youtube.com/watch?v=BBPoInSOiOY
1.1 Python Tutorial from Code Academy
Especially the first two weeks (weeks 6 & 7), we will follow the Python tutorial from Codeacademy available from: https://www.codecademy.com/learn/python
You are expected to complete the Parts 1-9 within the first two weeks of the module and Parts 11 and 12 in the second two weeks. See the class schedule below for completion time frames.
Guide Sections
- Python Syntax
- String and Console Output
- Conditions and Control Flow
- Functions
- Lists and Dictionaries
- “Student Becomes the Teacher” – Implementing a Gradebook
- Lists and Functions
- Loops
- “Exam Statistics” – Calculations in the Gradebook
- Advanced Topics in Python (first part only) [OPTIONAL]
- Introduction to Classes
- File Input and Output
Most of this material is also covered in the following 45min video, which emphasizes the use of lists and functions: “Learn Python in one Video”: https://www.youtube.com/watch?v=N4mEzFDjqtA
1.2 Videos – See the class schedule below for completion time frames.
• The fundamentals of writing computer programming: https://www.youtube.com/watch?v=YCDTYlUWkQE
• Why you should learn Python Programming: https://www.youtube.com/watch?v=G8brQdClo9s
• Python 3 Programming Tutorial – Common errors: https://www.youtube.com/watch?v=AWIgW_F_k50
• Python Tutorial – Working with Files: https://www.youtube.com/watch?v=Uh2ebFW8OYM
• Python for Beginners: Reading & Manipulating CSV Files: https://www.youtube.com/watch?v=mlt7MrwU4hY
• Object Oriented Programming in Plain English: https://www.youtube.com/watch?v=Ro2KVzkNte4
• Computer programming: What is object-oriented language? https://www.youtube.com/watch?v=SS-9y0H3Si8
• What Is Object Oriented Programming And Why? https://www.youtube.com/watch?v=DjfUw8gGY-I
Python Object-Oriented Development
• Tutorial 1: Classes and Instances: https://www.youtube.com/watch?v=ZDa-Z5JzLYM
The following additional tutorials are optional:
• Tutorial 2: Class Variables: https://www.youtube.com/watch?v=BJ-VvGyQxho&t=43s
• Tutorial 3: classmethods and staticmethods: https://www.youtube.com/watch?v=rq8cL2XMM5M&t=18s
• Tutorial 4: Inheritance, Creating: https://www.youtube.com/watch?v=RSl87lqOXDE
1.3 Readings
• “Computer Science and Programming”: a short introduction to Computer Science and Programming (Chapter 0 “The Study of Computer Science” from Punch & Enbody: “The Practice of Computing using Python, 3rd edition”)
• “An Introduction to Python Lists”: http://effbot.org/zone/python-list.htm
• “Functions”: http://zetcode.com/lang/python/functions/
• “Debugging – 7 steps to fix an error” http://www.makinggoodsoftware.com/2009/06/14/7-steps-to-fix-an-error/
• “16 Common Python Runtime Errors Beginners Find” http://inventwithpython.com/blog/2012/07/09/16-common-python-runtime-errors/
• “Naming Conventions”: a summary of how to write “Pythonic” code that is easy to understand, including standard ways to name your code (from Enbody, www.cse.msu.edu/~cse231/General/NamingConventions.pdf )
• “Python Style Guides” http://www.cs.bu.edu/courses/cs108/guides/style.html and https://robinwinslow.uk/2014/01/05/summary-of-python-code-style-conventions/
1.4 Supplemental Readings and Resources
• An introduction on how to use the GlowScript editor: http://www.glowscript.org/docs/GlowScriptDocs/index.html
• Python Code Style with lots of examples: http://docs.python-guide.org/en/latest/writing/style/
• PEP8 – The Style Guide for Python Code: http://pep8.org/
• Very brief summary of naming conventions: http://visualgit.readthedocs.io/en/latest/pages/naming_convention.html
• Python Debugging (fixing problems) http://www.cs.bu.edu/courses/cs108/guides/debug.html
• Error Handling: https://en.wikibooks.org/wiki/A_Beginner’s_Python_Tutorial/Exception_Handling
The above readings are only illustrative. If you do not find the specific information you need, search the web.
2. SCHEDULE & BLOG ASSIGNMENTS
Also see http://www.glowscript.org/#/user/torsten.hahmann/folder/Public/program/DockScene
Week 6 Tuesday |
|
Week 6 Thursday |
|
Week 7 Tuesday |
|
Week 7 Thursday |
|
Week 8 Tuesday |
|
Week 8 Thursday |
|
Week 9 Tuesday |
|
Week 9 Thursday |
|
3. TWO-WEEK PROJECT ASSIGNMENTS
Python Project Assignment 1 (due at end of Week 7) – Programming a Crane
You are given a toy world with a container ship, a dock, and a crane. You are also given an initial configuration of all the containers on the ship in the form of lists, where each list describes one stack of containers on the ship.
You are tasked with describing at least one custom configuration of containers on the ship using the following requirements:
- The ship consists of at least 15 containers in total that are distributed across 8 stacks in total.
- Each stack contains at least 1 and at most 3 containers.
- There is at least one stack of 1, one stack of 2, and one stack of 3 containers.
Apart from these restrictions, you are free to place containers as you wish on the ship as long as they are fully within the ship’s load area.
Each stack should be a list of containers, named stack1, stack2, …, stack8.
You are also tasked with writing a program that unloads an entire container ship by moving all containers from a ship to the dock. Test this program on the initial configuration and on your custom configuration. Make sure that it unloads all containers to the dock.
You have a crane available that can pick up one container at a time. You can operate the crane by moving it horizontally (moveCraneTo(x,y)), lowering and raising its hook (liftTo(z) and lowerTo(z)), and picking up and releasing containers (attachHook(), releaseHook(), whatsOnTheHook()). You are free to choose in what order to unload the containers and where you place them on the dock within physical limits.
Test your program with at least two different ships with different arrangement of containers. In class, together with the instructor and student CLA, we will also test your program with ships from other project groups.
Submit a short report that includes a description of your program and how it is structured. Also make sure that you use comments throughout your program to explain important steps and functions.
Grading: Late project submissions result in lowering of full grade per week.
Rubric
Grade | Performance |
A | Program works flawlessly with any arrangement of containers submitted by any of the teams. Your code is easy to follow with the help of the comments and report. Your list of containers satisfies all the above requirements. (A- if minor parts are not commented or are difficult to follow). |
B | Program works as for an A, but has at least one of the following deficiencies: • difficult to follow, very sparsely commented or the report is not submitted; • no stacks of containers are provided by the deadline (due Sunday evening) or the stacks do not fulfil all requirements; • program does not work on 1 or 2 arrangements from other teams. |
C | Program works (i.e., unloads the entire ship) only when used with the default ship and your own arrangement. |
D | Program only partially unloads (at least three stacks of containers) the default ship, but does not fully unload the default ship. |
F | Program does not run because of syntax errors and functional program without syntax errors not turned in within two weeks of the deadline. |
Python Project Assignment 2 (due at end of Week 9) – Programming a Crane Further
You are to improve your program in two ways:
- write a function, called loadContainers(csvFile), to read information about a ship’s containers from a CSV file; and
- write another function, called unloadShip(listOfContainers), that automatically unloads all containers onto the dock, neatly organized by owner. It should also output the total distance traveled by the crane’s hook.
For the CSV file, you can assume that each row in the file describes one container with the following properties (in this order): name, shipper, X coordinate, Y coordinate, Z coordinate. You a strongly encouraged to develop the function to read a CSV file on your own computer first, before trying to make it work on GlowScript.
To test the function unloadShip(listOfContainers) independently of the function that reads containers from a CSV file, we provide a function NextShipPlease(numberOfContainers) that returns a random arrangement of a number of containers (as specified by the parameter numberOfContainers, must be within 1-75) on a ship. For this function and any of the CSV files we provide, you can make the following assumptions about containers:
- there are at least 1 and no more than 75 containers;
- no more than 5 containers are stacked on top of each other;
- there are no more than 5 columns (in X direction) and 3 rows (in Y direction) on a ship;
- all containers are within the ship’s loading area;
- all containers are perfectly stacked on top of each other (no overhang, etc.).
However, the placement of the bottom containers within the load area may vary, so you cannot make assumptions about their precise locations.
Grading: Late project submissions result in lowering of a full grade per week. A program that is off topic will acquire at most a B-
Rubric
Grade | Performance |
A | All aspects of the program work flawlessly with any arrangement of containers on a ship as long as they are within the load area and are not stacked higher than 5 containers. Your code is easy to follow with the help of the comments and report. (A- if minor parts are not commented or are difficult to follow or if the total distance travelled by the crane’s hook is not correctly calculated). |
B | Program works as for an A, but has at least one of the following deficiencies: • difficult to follow, very sparsely commented or the report is not submitted; • the program fails to read a list of containers from a file; • the containers are placed on the dock without any clear organization by owner. |
C | The program has two or all of the deficiencies listed in B. |
D | The program fails to unload arbitrary arrangements of containers without collisions. |
F | Program does not run because of syntax errors and functional program without syntax errors not turned in within two weeks of the deadline. |
Blog Index (protected)
Project Archive Index (protected)
COS 120 Introduction to Programming by School of Computing and Information Science is licensed under a Creative Commons Attribution 4.0 International License.