3.2 KiB

-Open Classrooms courses-

[PyDev] Projet 3

Help MacGyver to escape!


Imagine a 2D labyrinth in which MacGyver would have been locked up. The exit is watched over by a bodyguard. To distract him, you need to combine the following elements dispersed in the labyrinth:

  • a needle
  • a tube
  • ether

They'll allow MacGyver to create a syringe and put our guard asleep.


This have been made with python 3.6.4 and pygame 1.9.3

On Linux

  1. Clone repo: git clone https://github.com/freezed/ocp3
  2. Install dependences: cd ocp3; pip3 install -r requirement.txt
  3. Run it: python3 main.py

Other OS

Feel free to contribute, I do not use other OS


  • main.py, main script the one to run
  • conf.py, place for variables, constants and fuctions
  • maze.py, Maze class
  • player.py, Player class
  • gui.py, GraphicUI class
  • 01.maze, maze file
  • img/, directory for image files
  • requirement.txt, dependences for feeding pip
  • README.md, you're reading it!


  • One level. The structure (departure, location of the walls, arrival), should be saved in a file to easily modify it if necessary.
  • MacGyver will be controlled by the directional keys on the keyboard.
  • The objects will be randomly distributed in the maze and will change locations if the user closes the game and raises it.
  • The game window will be a square of 15 sprites length.
  • MacGyver will have to move from square to square, with 15 squares along the window's length
  • It will retrieve an object simply by moving on it.
  • The program stops only if MacGyver has recovered all objects and found the exit from the maze. If he stupid enough to comes in front of the the guard without all the objects, he dies (according to the evolution theory).
  • The program will be standalone, i. e. it can be run on any computer.


  1. Create the starting frame
    • Initialize a Git repo on Github
    • Create the labyrinth without the graphical user interface
    • Start the graphical interface with PyGame
    • Represent the guard, MacGyver and the objects in your program and placed them at the beginning of the game
  2. Animate the character
    • The only moving element is MacGyver, create classes methods for animation and finding the exit
    • make a simplified version of the game in which MacGyver wins when he arrives in front of the goalkeeper
  3. Recovering objects
    • Add object management
    • The way he pick them up
    • Add a counter that will list them.
  4. Win!
    • MacGyver has picked up all the objects and asleep the guard


  • program hosted by Github
  • 2 pages text doc (pdf) explaining your approach:
    • including the link to your repo
    • develop the choice of algorithm
    • explain the difficulties encountered and the solutions found


  • version your code and publish it on Github
  • follow the good practices of PEP 8
  • develop in a virtual environment using Python 3
  • code must be written in English