Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due
CS106 Final Project
The final project in CS106 is an opportunity for you to showcase what you have learned in this class, and begin applying your newfound knowledge and abilities to a problem that interests you personally.
The final project is to be an individual or a small group project, although I hope that in either case you consult with others in the class and with professors (if possible) for help in design, implementation, and debugging.
Timeline (Milestones)
There will be four deliverables for this project, due according to the following schedule:
-
Project Design (2%): You submit a document outlining what your project will do. See below for more details. Due Friday, Nov. 17, end of day.
-
Project Walkthrough (3%): You and I meet to look at what you have completed. I will recommend solutions to problems you are having. At least 50% of your code must be complete when we meet. Scheduled for the week of Nov. 27.
-
Project Showcase (5%): during our final exam time, those who have presentable work will present their work to the class. You should be able to run your code at this time. If you have concrete results to show, please do so. You may want to have a web page or PowerPoint slides to describe what your project does. For a team project, each team member should contribute to the presentation.
-
Project Submission (90%): You submit your final project code by the end of the day of our final exam time. See details below. Since the problem-solving process is essential and cannot be evaluated on the basis of code alone, code submitted without a walkthrough will not be graded.
I will combine the points from these deliverables to compute your score for the final project/presentation.
Details for each milestone are below:
Milestone 1: Project Design
This document should include:
-
A high-level description of the project
-
What might be the main challenges you’ll have to overcome for this project? What is your plan to tackle them?
-
What might be some of the different pieces of the project that you can work on developing one at a time? Specifically:
- What are some of the functions or classes you might use?
- How you might know whether each part is working?
- What data will your project store? What data types will you use, and how?
-
What you expect the input and output to look like: if it is text, then a quick sample of what it will look like. If it is graphical, a description or sketch of it.
-
The ways a user can alter the run of the program by changing input.
The document should be a Word document, PDF document, or text document (not Python code).
It’s okay if you don’t have everything fully designed; expect the project to take shape as you go. But note that the more work you do on your design, the less time you’ll have to spend writing the code (because you’ll implement more of it correctly the first time).
General Notes
I encourage you to investigate and (hopefully) use existing Python packages. Interesting ones include:
- Plotting and Visualizing: matplotlib, plotly, see other examples in Streamlit’s docs
- Simulation: vpython, pymunk, …
- Calculating: numpy, scipy, pandas, sklearn
- Others: sympy, spacy, transformers, way way more
Many final projects fall into one of two categories: simulations and data analyses.
For simulations, it is often best if you can create a class representing each of the types of “actors” in your simulation. Then, if you create multiple instances of these classes, how do they interact with each other? For a simulation project, you must have a hypothesis you are trying to test. You cannot just create multiple agents and “see what happens.”
Data analysis projects take data and manipulate it, either to analyze its properties, or to allow users to visualize it in new ways. To do this kind of project, you need data (that should be obvious, but I thought I’d point it out anyway). I would much prefer that you don’t pick a project where you have to collect, gather, or fabricate your own data. You don’t need extra work to do.
In either case, your project must be interactive with the user. Streamlit is one obvious choice for interactivity. You may also use turtle graphics (see the docs for details on its input functionality), Shell input(), files, or the command line (using sys.argv, or something fancier like click or the built-in argparse library).
Ideas
-
Take something we did together (class, lab, etc.) and extend it in some way. (Some assignments have “optional extensions”; do a few of those?)
-
Teach a concept from an area of interest to you. e.g., find a YouTube video that explains something (like one of the excellent 3blue1brown videos or others), make an interactive version of that explanation.
-
Update the prof’s Workday-to-Calendar app to work with student class schedules. Add tests.
-
Make some generative art!! For some inspiration, see:
- Jonathan Chaffer’s CS Seminar slides
- #genuary
- #RecreationThursday (original pieces)
- Generative Art at ObservableHQ
- Truchet images | Ned Batchelder
- generativepy tutorial
- the “Animation Demo” that shows up when you run streamlit hello (see it running on the web)
-
Solve a few river crossing puzzles.
-
Simulate how political (or other) polarization develops. Example blog post.
-
Build a traffic simulation. e.g., can you time traffic lights to maximize flow?
-
Use SymPy to check someone’s algebra and show them what step they made a mistake on.
-
Create a star/planets/satellites simulation to model our solar system with actual values for planet masses, distances, etc.
-
Get some inspiration from Peter Norvig’s pytudes “Python etudes”
-
Simulate a game with emergent behavior, like the Monty Hall Problem.
-
Simulate a ball being shot out of a cannon and bouncing on the ground. What if the wind picks up? Or gravity increases?
-
Simulate a predator/prey situation: wolves eat mice, so the mouse population goes down, so the wolf population goes down, so the mouse population goes up, so the wolf population goes up, and so on. Can it be extended to involve 3 species? I want to see graphs! And, it would be nice if it could be based on some actual data (found on the web, or elsewhere).
-
Iterate over a collection of atoms/molecules and compute whether or not they can (theoretically) combine. If they can combine to form a new molecule, can you determine its official name. Can you use pymol to visualize the molecule?
-
Implement code to demonstrate the Monty Hall Problem.
-
Newton’s method illustration
-
Make a game. Many options are available; sample code for a Tic-Tac-Toc game, guessing game, and colliding-particles games are available on request. In prior years, students have built games including Evil Hangman, Connect Four (based on the tic-tac-toe code), Battleship (using turtle graphics), Minesweeper, etc.
-
Work with some text data using spacy or transformers.
-
Conway’s Game of Life or some other cellular automata (many examples are shown in the thick book “A New Kind of Science”; there is a copy in the math-stats reading room.)
-
Solve an interesting problem or two from projecteuler.net
Milestone 4: Final Code and README
Submit a ZIP file on Moodle that includes:
-
Your code
-
If any data is needed to run the code, please either include the data in the ZIP file or provide specific instructions for how to obtain it (e.g., go to a certain URL).
-
A screenshot or very brief video of your project in action.
-
A plain-text README.txt file (which you can create using Thonny or another app like Notepad or TextEdit) that looks like:
Title: (a title for your project) Author: (your name) Objective: 1-2 sentence description of your project's goal How to demo:*Specific instructions for what to do to run through a basic demo of the main functionality of your project.*You don't need to show off all features here. Highlights:*List a few parts of the program that you're proud of.*This could be something tricky you got working or how you organized your code. Process:*A one-paragraph summary on your process for creating the code. Include at least one specific difficulty that you encountered and how your overcame it.*Testing:*What steps could someone do to check that your code works correctly?*For example, if your program used to have a bug but now you fixed it, describe how you can test that it's fixed. (If you use assert statements, running the code may suffice.) Sharing: Would you be okay with sharing your project, and if so, how?-Ideally we'd make a public gallery with all projects, screenshots, and code, but you could choose to:-Go anonymous (answer "anon" or "names")-Don't share code? (answer "code" or "screenshots" or "just title")-Restrict to just future students (answer "public" or "students").
Grading
I will grade your project submission as follows:
-
50%: code is complete and correct
-
10%: the README describes a simple and clear way to test that the code is complete and correct
- This is especially important the more complex the code is.
- Ideally you’d use assert statements or other kinds of automated testing, but a testing script (“click this, that should appear, and it should be less than the other thing”):
-
10%: code is well structured: easy to change correctly
- major functionality separated into manageable chunks using functions, classes, modules, etc.
- clear separation between “frontend” stuff (that uses input()/print/streamlit widgets) and “backend” stuff (that doesn’t).
- minimal duplication
- constants used for any “magic” numbers
-
10%: documentation
- variables, functions, function parameters, and classes have clear and consistent names
- anything non-obvious has an accurate and sufficient comment and/or docstring
-
5%: submission ZIP file includes a README with all elements given above
-
5%: submission ZIP file includes a screenshot or brief demo video
-
10%: complexity/significance of the project
Note that it is better to choose a final project that is not overly complex and get it right than it is to choose a project that is too complex and not finish it. I recommend that you find a project that you can implement in stages, so that at multiple points you can have a “finished” project, and then decide if you want to or have time to proceed to the next stage. If you choose this route, it would be best to document these stages in your design document.
Testing
You can use assert to test your functions. For example:
Reuse vs Plagiarism
It can be very helpful to find an example we did in class (lab, homework, etc.) that is similar to what you want to do and adapt it. This is highly encouraged. Just note that you did so in your code documentation.
If you intend to use code from other people outside of the class, talk to us first and remember that we’ll grade you on the code you write, not on what other people write. If you do make use of existing code and libraries, be sure to clearly indicate who wrote what parts of the code; using code without proper attribution is a form of plagiarism.
Feel free to discuss ideas with us or with your classmates, but don’t copy code (i.e. plagiarize). Here are examples of what plagiarism looks like:
- You find a program online and copy the entire contents of the file into your submission without attribution.
- You find code online, and change the variable names.
- Your roommate writes some code, which you add to your program. You add documentation that shows you understand the code, but never indicate the source of the code.
- Your older sibling sends you a function that will help your program. You add it to your submission without attribution.
Consider these rules of thumb:
- If you found it efficient to use copy/paste to create some portion of your application, you must supply documentation that indicates the original source of the code.
- If the moment you figure out how to do something occurs while you are looking at a website, you should document that website.
Note that these rules of thumb apply to the code supplied in this course’s materials as well.
Resources
- Project Code Samples
- awesome-python or similar
Streamlit stuff
- In lab we did image manipulation by hand, but for your project you can use functionality that’s built into the Pillow library.
- Streamlit Components - Community Tracker
Games in Streamlit
State management in streamlit is a bit tricky because the file re-runs from the top every time. I usually solve this by having a game-state object that gets stored in session state; see this grid demo. Here are some more examples and documentation:
- You’ll need to understand something about Session State (their blog post).
- tic-tac-toe demo
- some more examples (see my fork)
Other Game Engines
There’s lots of game engines for Python. Some of them might be hard to learn, but might be worthwhile depending on the complexity of what you’re trying to do.
Datasets
- Kaggle Datasets
- data.gov
- Our World in Data
- CORGIS Datasets Project (“The Collection of Really Great, Interesting, Situated Datasets”): https://think.cs.vt.edu/corgis/
- NOAA climate data
- US Geological survey live feeds, including recent earthquakes