Tigran Harutyunyan

Introduction to Programming for Engineers

About Me

Welcome to my personal course page. Here I present my homework and projects created during the course.

Project

Snake Game

C and Python project — classic Snake game implementation

A Snake game built in C with a Python interface layer, featuring:

  • Game logic written in C for performance
  • Python UI layer using a compiled C extension
  • Bridge between C and Python via snake_bridge

The project demonstrates C programming, Python integration, shared libraries, and Makefiles.

▶ How to Run on Your Linux Machine

Step 1 — Install dependencies (once)
sudo apt install build-essential python3-dev libncurses-dev
pip3 install pygame setuptools --break-system-packages

build-essential → gcc to compile C code  |  python3-dev → Python headers for the C extension  |  libncurses-dev → needed for the algo stage terminal versions  |  pygame → graphical window  |  setuptools → needed to run setup.py

Step 2 — Build the C extension (once, or after changing .c files)
cd your_snake_folder
python3 setup.py build_ext --inplace

This compiles snake_game.c and snake_bridge.c into a .so file. A file like snake_bridge.cpython-312-x86_64-linux-gnu.so will appear — that is normal.

Step 3 — Run the game
python3 snake_ui.py

A window will open. That is it!

Source Code Viewer
Click a button to load a file here.
Select one of the project files to preview its contents.

Homework

Source Code Viewer
Click a button to load a file.
Select a file to preview its contents.