The famous solitaire game using python libraries for graphical environment
The project is an equivalent realization of the well-known game of Klondlike Solitaire using cross-platform set of Python modules for computer graphics and sound libraries. The goal is to turn the entire deck into stacks and if this is achieved, the Solitaire game is won. The implementation is based on 3 main axes:
- Menu Scene
- Other scenes (Win/Lose/Τransitional)
- Game/Play environment
- Graphical design of components
- Introductory/final scenes
- Multimedia effects
- Hint buttons
- Install python1 environment. The instalation is easy either on Windows or Linux
- Install pygame2 modules
- Install Python IDE
- This implementation is made in pyCharm
- https://www.python.org/downloads/
- Link for the Windows installer python-XXX.msi file where XXX is the version you need to install.
- Update the PATH variable
- Update repositories lists and supporting softwares
$ sudo apt update
$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt update
- Install main package
$ sudo apt install pythonXXX
where XXX version installed1
- Verify install completion
$ python --version
- On any windows shell
python --version
pip install pygame
- Check the PyGame is working
import pygame
- On terminal, first make sure you are using latest version of python3 with
$ python3 –version
,
then
$ sudo apt-get install python3-pygame
- Check PyGame is working with python
python 3
pygame 1.9.6
- Insert folder in PyCharm workshop
- File->Settings->Project->Project Interpreter
- Create virtual environment and install packages
- pip install python
- pip install pygame
- pip install pyautogui
- pip install pil (or pillow)
- Run .py
- Create virtual environment
python -m venv /Solitaire.py/venv
- Activate
.\venv\Scripts\activate
- Install packages
- pip install python
- pip install pygame
- pip install pyautogui
- pip install pil (or pillow)
- Install dependencies
pip install -r requirements.txt
- To update dependencies
pip freeze > requirements.txt
- Make standalone executable
auto-py-to-exe
- Script location - Solitaire.py
- One directory
- Windows Based
- Icon - background.ico
- Additional Files
- After py2exe is done, make standalone structure. Move files to make structure like this
├── internal
│ ├── venv/
│ ├── image/
│ ├── Cards.py
│ ├── Bitmapfont.py
│ ├── MainMenu.py
│ ├── Raspigame.py
│ ├── Solitaire.py
│ ├── Interstitial.py
│ └── SolitaireGame.py
└── playing_cards (etc.)
...
etc. -> Structure continues with
- fasttracker2-style_12x12png
- cas music.wav
- background.png
- back.png
- Play
python Solitaire.py
- Animation
- Web App (using flask etc.)
- Finding hints as stack
- press button 1st time show 1st hint
- press button 2nd time show next hint etc.
- and more
- This project was created for the requirements of the lesson Autonomous Agents
- The implementation was influenced by Raspigame for creating basic games.