Skip to content

This is a self-guided tutorial to help folks learn how to use GitHub Copilot using the CodeTour extension to build a rock, paper, scissors game

License

Notifications You must be signed in to change notification settings

blackgirlbytes/rock-paper-scissors-copilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build a Rock, Paper, Scissors Game with GitHub Copilot

Description

This is a self-guided tutorial to help folks learn how to use GitHub Copilot. In this project you will find:

  • a main.py file with no contents
  • a devcontainer that installs CodeTour and GitHub Copilot when the Codespace is created
  • a CodeTour to guide the developer through using GitHub Copilot to develop a rock, paper, scissors game.

To complete this tutorial, you will need:

How does this work?

The CodeTour prompts developers to write comments and lines of code that trigger GitHub Copilot to generate code to create a rock, paper, scissors game.

How to use the guided CodeTour

  1. Choose 'Use this template', and 'Open in a codespace'

Open in a codespace image

  1. Choose the “Explorer Icon” on the left sidebar of your editor.

Highlighting the Explorer Icon

  1. Toggle the CodeTour panel

Highlighting the Code Tour panel

  1. Press the “Play button” to start the tour.

Highlighting the Play button

  1. Your CodeTour will begin! Follow the CodeTour’s steps to learn how to use GitHub Copilot.

Highlighting the start of a CodeTour

Your CodeTour will take you through the following steps

  1. Introduction: Hi there! this is a guided tour to help you learn GitHub Copilot. We will build a rock, paper, scissors game with Python.

  2. Let's give 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.

Write a rock paper scissors game comment

Now, let's prompt Copilot to import the random module. Write this comment # import random module on the next line. Press enter to create a new line and accept Copilot's suggestion.

Screen Shot 2023-03-03 at 6 58 46 AM

  1. Now, let's prompt Copilot to create a main function that handles the logic of the game with a comment that says # define main function that handles all the logic. Press enter to create a new line and accept Copilot's suggestion.

define main function

  1. Now, let's prompt Copilot to call the main function. Write this comment # call main function on the next line. Press enter to create a new line and accept Copilot's suggestion.

Call main function

  1. Try it out! Let's run the code to see if it works. In your terminal, run python3 main.py. It should start the rock, paper, scissors game. Mission complete! You've used GitHub Copilot to create a rock, paper, scissors game in Python!

Playing the game in the terminal

About

This is a self-guided tutorial to help folks learn how to use GitHub Copilot using the CodeTour extension to build a rock, paper, scissors game

Topics

Resources

License

Stars

Watchers

Forks