Skip to content
/ pool Public

A pool game written in python and pygame.

License

Notifications You must be signed in to change notification settings

max-kov/pool

Repository files navigation

Pool

build status

A pool game written entirely in python!

Alt text

Features

  • Realistic collisions based on a two-dimensional Newtonian model.
  • Simple configuration file (config.py) with many changeable options like ball size, ball colour, cue length/thickness and many more.
  • Algorithms which render ball sprites using rotation matrices.
  • Tests for collision functions and other math related functions.
  • A small and configurable game menu.

Installing

Dependencies

The pool game requires python 3.5 with modules which are listed in requirements.txt .

Installing on debian-based linux distributions

Install python 3.5 with pip, venv and pygame dependencies

sudo apt-get build-dep python-pygame
sudo apt-get install python-dev python3 python3-pip python3-venv

Then, clone the github code and run the game using run.sh, which will setup a virtual python environment with the aforementioned modules.

git clone git://github.com/max-kov/pool.git
cd pool
./run.sh

If the pygame installation fails, it's most likely due to apt not having any URIs in sources.list file. To fix execute

sudo sed -i -- 's/#deb-src/deb-src/g' /etc/apt/sources.list && sudo sed -i -- 's/# deb-src/deb-src/g' /etc/apt/sources.list
sudo apt-get update

and run the installation procedure again.

Windows

Download python 3.5 with pip then add python to the path variable and run

python -m pip install -r requirements.txt

in the administrator cmd in the game folder to install the dependencies. Finally, start main.py to run the game. You might have to use python3 instead of python depending if you have python2 installed. To check that you are using the right vesrion, write python in the console to see what version is used.

Running the tests

You can always see the results of the latest build here. If you want to run the tests yourself, we will need extra modules. (On linux) Run

pip3 install -r test_requirements.txt

in the game folder to install the testing modules. To run the tests write

PYTHONPATH=./pool pytest tests/

You can also check test coverage by executing

PYTHONPATH=./pool pytest --cov=. tests/

That will analyse which files and which lines of code were executed by the tests..coveragerc will prevent the module from analysing test files as well.

Built With

About

A pool game written in python and pygame.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published