Code Monkey home page Code Monkey logo

pool_intphys's Introduction

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

pool_intphys's People

Contributors

max-kov avatar chameleon-lizard avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.