Skip to content

Kurama625/dice_game

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome in Dice Game!

This project has been created by students in Kristianstad university in Sweden.

Bellow are steps and setups you need to follow all features.

The basic goal of the project, is to reach clean, bugs free code.

Game has been developed using python OOP. The way to approach clean code with no (unaware dimensions) has been reach by writing unittest for classes used in project.

Setup you need

I am expecting you to have make installed

Have Make on your environment (in case you want to enter short comman lines)

www.chocolatey.org/packages/make

New version of pip, some features are not working with old one!

on mac:

pip3 install pip --upgrade

on win:

pip install pip --upgrade

and finally

To be able to try all features, it is preferred to create Virtual Environment.

Create venv

Navigate into repo if you are a windows user, use always python insteade of python3

env is the name of the VE you going to create

python3 -m venv env

To activate it write:

. env/bin/activate

To activate it on windows:

. env/Scripts/activate

To deactivate it on both operating system:

deactivate

Notice that if you are a windows user, I am expecting you to use GIT-bash.

If you want to avoid creating VE. You may use comman line mentioned in section bellow.

Download requirements

After activating enter the following command:

Python3 -m pip install -r requirements.txt

check that your pip list

pip3 list

If the list does not have more that three lines. Then your installation faild.

You need to upgrade your pip using the following comman

pip3 install pip --upgrade

pip if you are on windows

Now, let gets start

Run the game:

Navigate into dice_game the folder where dice_gama a folder, using cd dice_file

python3 main.py

Notice that you enter another terminal, and you would not exit it unless you enter q or other exit commands.

You can always press ? or help to get the introduction within game terminal.

Testing:

After you are done with the game, let us trying tests some code.

Enter:

To run unittest and get the report about testing.

make coverage

To get a visual report about which lines have been covered and which not.

make html

A new folder is created htmlcov. You find the reports in it

Run flake8, code cleaner.

make flake8

Run code analysis.

make pylint

Run both tests.

make test

UML

Create uml for whole the package.

make pyreverse

You got ump with .png extension within dice_game folder.

To ganerate UML for only game class.

make game

If you want to ganerate an UML for another class. Enter the following:

change class to the real name of class

pyreverse class.py
pyreverse -o png -p pyreverse class.py

Documentation:

Assume you are on repo directory Navigate to dice_game/docs/ and enter

make html

And by now, the documentation for the project has created to open it:

cd _build/html

you need to open index.html

If you are on windows:

start index.html

mac:

open index.html

Manualy comman lines

If you do not have choco

Inside dice_game folder:

To test all module within the pachage:

coverage  run -m unittest discover . “test_*.py” 

Create report AFTER running tests:

coverage report -m

Create HTML report:

coverage html

Run flake8:

 flake8

To run pylint on all file:

pylint *.py

UML:

pyreverse *.py

To genetate UML for whole the pachage.

pyreverse -o png -p pyreverse *.py

Reference:

Some parts of code taken from:

https://gitlab.com/mikael-roos/sustainable-programming-exercise
https://stackoverflow.com/

About

dice_game (Pig) Exam_2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.8%
  • Makefile 2.2%