Welcome to GitHub Copilot!
For this first dive, we will take a look at a very familiar game and see if we can leverage GitHub Copilot to help us create all the functioning code necessary to setup Rock, Paper, Scissors with a little twist. This is a cli game and use any scripting language of your choice e.g. python, bash, pwsh etc.
- CoPilot license
- Create a terminal rock paper scissor game for 2 players: computer and user
- Let the game continue until the user wants to quit
- Add a leader board that sums up the score
- Refactor and optimize. Keep it DRY
- See if you can refactor and add unit tests to some of the logic
- Add lizard and Spock choices as well.
- Add the option to input emoji icons as input as well. Hint:
- Let's start with giving GitHub Copilot some context about what we're building. Write this comment
# Write a rock, paper, scissors, game
at the top of your main.py file. - Now, let's prompt Copilot to import the random module. Write this comment
# import random module
on the next line. You will probably need this module! Press enter to create a new line and accept Copilot's suggestion. - From this point one, craft a prompt to define the main function with all the logic and call the main function. Use either inline CoPilot or CoPilot chat to add feature based on the objectives in an iterative manner, step by step. Don't worry if you do not know python and use CoPilot to learn.
- Good luck!
In case you get stuck, have a look at this workshop repository. There are more instructions on how to progress and even a codetour and a codespace with python installed. https://github.com/copilot-workshops/copilot-rock-paper-scissors