Memory Game is a classic memory game implemented as a console application for two players. Players take turns revealing two cards, trying to find pairs of identical symbols. A player who finds a pair can take another turn. The person who collects the most pairs wins.
The game was created using modern Python libraries, providing a pleasant user interface despite its console-based nature.
- Gnome terminal
- Kitty terminal
- Python 3.8 or newer
- Pip (Python package manager)
- Install Python:
- Download and install Python 3.8 or newer from python.org
- During installation, check "Add Python to environment variables"
- Open Command Prompt (cmd) as administrator
- Clone the repository and navigate to the project directory:
git clone <repository-url>
cd memory-game- Create and activate virtual environment:
python -m venv venv
venv\Scripts\activate- Install the game:
pip install .- Install Python (if not installed):
- Debian based distributions (use appropriate package manager and packages for other distributions)
sudo apt-get update
sudo apt-get install python3 python3-pip python3-venv git- Clone the repository and navigate to the project directory:
git clone <repository-url>
cd memory-game- Create and activate virtual environment:
python3 -m venv venv
source venv/bin/activate- Install the game:
pip install .After installation, you can run the game in one of the following ways:
python main.py -c config/default.ini
# or
python -m src.memory_game.app -c config/default.ini
# or
memory-game -c config/default.ini
# or
memory-game- To see available launch parameters:
python main.py --help
# or
memory-game --help- The game begins with choosing the board size (max. 6x6)
- After selecting dimensions, a board with hidden cards appears
- Players take turns selecting two cards
- If the cards form a pair:
- Player gets a point
- Cards remain revealed
- Player can make another move
- If the cards are different:
- Cards are hidden again
- Turn passes to the other player
- Game ends when all pairs are found
- To exit the game, use the keyboard shortcut
ctrl+q - To save game state, press
s - Loading game state is done through the configuration file described below
ctrl+pdisplays possible actions- Use
Tabto navigate through the board and buttons - In case of any errors, please check the
memory_game.logfile in the directory from which the game is launched
- Configurable board size
- Game state save and load system
- Encryption of saved game states
- Intuitive console user interface
- Colored markers and card symbols
- Score counter for both players
- Configuration through INI file
The game can be configured through an INI file containing the following sections:
width- board width (number of cards)height- board height (number of cards)
game_save_file- path to the file where game state will be saved when pressing "s"key_save_file- path to the file where encryption key will be saved
Note
The content of game_save_file will be completely replaced when saving game state.
Tip
By default, game state will be saved in the directory from which the game is launched in files game_save.dat and save.key.
game_load_file- path to the file with saved game statekey_load_file- path to the file with encryption key for reading game stateload- flag determining whether to load saved game (true/false)
Note
Paths in the configuration file can be relative (starting directory will be the launch location - current working directory) or absolute.
Tip
If load is set to true, game state will be loaded by default from game_save.dat and save.key files in the game launch directory. Loading game state is performed automatically at startup.
Example default.ini file:
[BOARD]
width = 2
height = 3
[SAVE_GAME]
game_save_file = /home/user/Documents/game_save.dat
key_save_file = /home/user/Documents/save.key
[LOAD_GAME]
game_load_file = /home/user/Documents/game_save.dat
key_load_file = /home/user/Documents/save.key
load = true



