Skip to content

Setting Up Your Project

Overview

This section will focus on setting up a local projects folder using the terminal.

Note

The terms "command prompt" and "terminal" are interchangable. Windows calls it the "command prompt", whereas developers often use the word "terminal". This document will describe the application as the "terminal" in this tutorial in preparation for your computer science degree.

Warning

You must be on a Windows operating system to follow this guide without any errors. If you are on a Mac or Linux operating system, then the following steps may not work for you.

Please read the typographical conventions here before continuing. Remember to press the "enter/return" key after typing in the terminal commands.

Opening the Terminal

This section will focus on how to open the terminal on a computer with a Windows operating system.

  1. Click on the Windows icon on the bottom left of your screen to access the "Start menu". windows start menu

    Note

    You can also press the "Windows" key often found at the bottom left of your keyboard.

    windows key

  2. Type command or cmd into the search bar and click on the "Command Prompt" application shown below to open it:

    command
    

    or

    cmd
    

    terminal for Windows1

    Note

    If there is no search bar, you may also type cmd right after accessing the Start menu.

    Success

    This window will pop up if you successfully opened the terminal.

    terminal for Windows2

Checking for Python on Computer

This section will ensure that PythonIconPython is properly installed on your computer using the terminal.

  1. Check the Python version in the terminal by typing one of the two commands below:

    python --version
    

    or

    python3 --version
    

    a. If python does not work, then try python3 instead.

    Success

    If Python is installed on your machine, then the terminal should display the version of Python that is installed, as shown in the image below.

    python installed

    Failure

    If running command resulted in an error message similar to the likes shown below, then Python is not installed on your machine.

    python not installed

    If your machine does not have Python, then download any 3.x.x version of Python here. The Python installation wizard will guide you through the process.

This section will focus on how to navigate file directories using the terminal.

  1. List out all directories you are currently in by typing the following:

    dir
    

    a. Afterwards, the terminal should look something like this. Your directories will be different.

    successful dir

    b. A directory will be labeled as <DIR>.

  2. Choose a directory that you want to put your project folder into.

    a. For example, you can choose an existing directory like Documents shown in the previous step.

    Notes

    Practice good file management. Select a folder that will hold all your future projects and keep it organized.

  3. Navigate to the chosen directory by typing the following:

    cd directory_name
    

    a. cd, also known as chdir, is a command that changes your current working directory to another directory.

    b. directory_name is a placeholder name. You can replace it with any directory that is listed when you typed dir back in the first step here.

    Success

    Successfully navigating to a directory using the terminal command cd will looking something like this:

    successful nav directory

Creating Project Folder

This section will focus on how to create a project folder using the terminal.

  1. Create the project folder by typing the following:

    mkdir rock_paper_scissor
    

    a. The project name rock_paper_scissor can be replaced with any name of your choice. This document will use the name rock_paper_scissor as the project name.

  2. Move into the newly created folder by typing the following:

    cd rock_paper_scissor
    

    a. Your terminal should look like this if you have created the rock_paper_scissor directory and navigated to it.

    successfulrpsdir

    Failure

    failedrpsdir

    If you cannot find the path specified, then go back to the first step here.

  3. Create a PythonIconPython file with the name rock_paper_scissor by typing the following:

    notepad rock_paper_scissor.py
    

    Warning

    If you have used your own project name, ensure that the name has the Python .py extension at the end. Excluding it will prevent the written code from running in Python.

  4. Click "Yes" when prompted to create a new file.

    create file prompt

  5. Check if the rock_paper_scissor.py file is in your current directory by typing the following:

    dir
    

    Success

    If you're successul, you will see the rock_paper_scissor.py file inside the rock_paper_scissor directory.

    It should not be labelled with <DIR> because it is a file.

    successrps.py

    Warning

    If you do not see the rock_paper_scissor.py file inside the rock_paper_scissor directory, then you must return here and follow the instructions again before proceeding with writing the code.

    Do not close the terminal. This guide will refer back to the terminal to activate other commands.

Conclusion

By the end of this section, you will have successfully completed the following using only the terminal:

  • Opened the terminal.
  • Navigated through file directories.
  • Created a directory for a project.
  • Populated a folder with a file.

The next section will focus on coding the game itself. Please proceed to Writing Your First Game.