The PyRat software on which the course is based can be installed on Linux, MacOS and Windows. Based on your choice (which should be Linux 😉 ), follow the instructions in the corresponding section below.

Linux

The following instructions have been written for Ubuntu (18.04 LTS). Still, they should work for most distributions (adapting the package manager, obviously).

Step 1: open a terminal

First, you should open a terminal. It is that black box where you can write system commands, which looks like that:

A Linux terminal.

If you are not familiar with what a terminal is, here is an introductory video.

Step 2: get Python 3

Normally, Python 3 should already be installed on your computer. You can check the version by writing the following command in a terminal:

python --version

If the result is python 3.X, with X greater or equal to 6, Python 3 is well installed. If you get a version 2 instead, try the following command:

python3 --version
  • Case 1: python3 is not found. Then, run the following command:
sudo apt-get install python3
  • Case 2: python3 is found. Then just replace all occurrences of python on this website with python3. Alternatively, you can create an alias so that python is recognized as python3 using the following command, and then restarting a terminal:
echo "alias python='python3'" >> ~/.bashrc
source ~/.bashrc

Step 3: install Pip

Pip is a library that allows an easy installation of most Python libraries. You can check if it is already installed by typing:

pip3 -V

If it is recognized, you’re done with this step. Oterwise, install it as follows:

sudo add-apt-repository universe
sudo apt-get install python3-pip

Step 4: install dependencies

There are a few dependencies for PyRat. You can now install them using Pip as follows:

pip3 install ipynb-py-convert pygame gdown

If PyGame fails installing, please install the dependencies detailed here, and relaunch the command above.

Step 5: get PyRat

Now that everything is set, you can download the PyRat software on this GitHub repository. Just click on the green button on the right and download the archive.

All you have to do now is to unzip the archive you just downloaded somewhere on your computer. This will be your workspace for the entire course.

Step 6: is everything right?

In your terminal, navigate (by using the cd command) to your PyRat workspace. Then, you can start a PyRat game by running the following command:

python pyrat.py --rat AIs/random.py

You should see the PyRat window, in which the rat is moving randomly. Remember: if you have not created an alias for python , you have to use python3 instead of python.

Remark: You can replace AIs/random.py above by a link to a Jupyter notebook, either located on your computer, or stored on your Google Drive account. To use the latter option, just allow sharing by link for the file on Google Colab, and use this link as an argument for --rat. You can find more info on the PyRat template Google Colab file.

MacOS

Step 1: open a terminal

A terminal is a window which looks as below where you can write system commands. Here are a few methods for starting one. Just follow the one you prefer.

Taken from here (cause I don’t have a Mac to illustrate)

If you are not familiar with what a terminal is, here is an introductory video.

Step 2: get Python 3 and Pip

In order to install Python 3 and Pip, follow the instructions on this page.

Then just replace all occurrences of python on this website with python3. Alternatively, you can change the default Python version so that python is defaulted as python3 as follows:

unlink /usr/local/bin/python
ln -s /usr/local/bin/python3 /usr/local/bin/python

Step 3: install dependencies

Pip is a library that allows an easy installation of most Python libraries. You should have already installed it in Step 2. Install the dependencies as follows:

pip3 install ipynb-py-convert pygame gdown

Step 4 : get PyRat

Now that everything is set, you can get the PyRat software on this GitHub repository. Just click on the green button on the right and download the archive.

All you have to do now is to unzip the archive you just downloaded somewhere on your computer. This will be your workspace for the entire course.

Step 5: is everything right?

In your terminal, navigate to your PyRat workspace (by using the cd command). Then, you can start a PyRat game by running the following command:

python pyrat.py --rat AIs/random.py

You should see the PyRat window, in which the rat is moving randomly.

Remark: You can replace AIs/random.py above by a link to a Jupyter notebook, either located on your computer, or stored on your Google Drive account. To use the latter option, just allow sharing by link for the file on Google Colab, and use this link as an argument for --rat. You can find more info on the PyRat template Google Colab file.

Windows

Step 1: open a terminal

Click on the windows menu at the bottom left on your screen (in general), and write cmd, then press enter. You should see a window like this one popping up:

Taken from here (cause I don’t have a Windows to illustrate)

If you are not familiar with what a terminal is, here is an introductory video.

Step 2: get Python 3

First, check your version of Python. Run the following command in the terminal:

python --version
  • Case 1: Python version is higher than or equal to 3.5. Then, you are done with this step;
  • Case 2: Python version is lower than 3.5. Uninstall the versions of Python you may have, then follow Case 3;
  • Case 3: Python is not found. Follow the instructions here to install it. Important: don’t forget to check the box to add Python to your PATH variable as in this picture:
Adapted with taste from here.

If you forgot to check that box, you can either reinstall Python, or update your PATH variable manually as described here. Warning: do not erase previous data in the PATH variable.

Step 3: install dependencies

Pip is a library that allows an easy installation of most Python libraries. Start a new terminal, then run the following command:

python -m pip install -U ipynb-py-convert pygame gdown --user

Step 4: get PyRat

Now that everything is set, you can get the PyRat software on this GitHub repository. Just click on the green button on the right and download the archive.

All you have to do now is to unzip the archive you just downloaded somewhere on your computer. This will be your workspace for the entire course.

Step 5: is everything right?

Open a terminal and navigate (by using the cd command) to your PyRat workspace. Then, you can start a PyRat game by running the following command:

python pyrat.py --rat AIs\random.py

You should see the PyRat window, in which the rat is moving randomly.

Remark: You can replace AIs\random.py above by a link to a Jupyter notebook, either located on your computer, or stored on your Google Drive account. To use the latter option, just allow sharing by link for the file on Google Colab, and use this link as an argument for --rat. You can find more info on the PyRat template Google Colab file.