In this activity, students will work in pairs to create a Rock-Paper-Scissors game using Python. This project will help them apply their programming skills while reinforcing concepts like functions, conditionals, and loops. Students will start by developing their game in a Jupyter Notebook, which allows for easy testing and iteration, and they will have the option to convert their notebook into a Python script later.
This project is designed as a one-day exercise where each pair of students will conceptualize, develop, and test their Rock-Paper-Scissors game. The activity will be structured into several steps to guide students through the development process.
- Choose Your Tools: Students will set up their development environment using Jupyter Notebooks.
- Create a New Notebook: Name it
rock_paper_scissors.ipynb
.
- Outline the Game Logic: Discuss the rules of the game:
- The player can choose Rock, Paper, or Scissors.
- The computer randomly selects one of the three options.
- Determine the winner based on the rules:
- Rock crushes Scissors
- Scissors cuts Paper
- Paper covers Rock
- Coding the Game:
- Import Required Libraries: Use the
random
library to allow the computer to make random choices. - Define Functions:
- Create a function to get the player's choice.
- Create a function to get the computer's choice.
- Create a function to determine the winner based on player and computer choices.
- Game Loop: Implement a loop that allows players to play multiple rounds until they choose to quit.
- Import Required Libraries: Use the
- Play & Test: Pairs should run their game in the notebook to ensure it works as expected. They should check for any bugs or logical errors and fix them.
- Extra Features (Optional): Students are encouraged to add additional features such as:
- Keeping score of wins, losses, and ties.
- Adding a user interface using libraries like
tkinter
(for advanced students).
- After completing their game in Jupyter Notebook, pairs can convert their notebook into a Python script (
rock_paper_scissors.py
) if they choose. This step is optional and can serve as an additional learning experience on how to structure code for scripts.
- Final Code Submission: Each pair will submit their completed Jupyter Notebook (
rock_paper_scissors.ipynb
) along with any additional features they implemented. If they converted their notebook to a script, they should include that file as well. - Documentation: Include comments in the code explaining key parts of the implementation and any challenges faced during development.
- Submit the link to pull request in Student Portal.
- After completing their projects, each student will share feedback in brief about 1-2 minutes each.
- The reflection, you should try to address each of the below:
- What they enjoyed most about working on the project.
- Any challenges they encountered and how they overcame them.
- Key programming concepts they learned through this exercise.