Skip to content

Classic memory game implemented as a console application βš™οΈ for two players. The game was created using modern Python 🐍 libraries, providing a pleasant user interface despite its console-based nature. πŸ˜‰

Notifications You must be signed in to change notification settings

Gibirizon/memory-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

en pl

Memory Game

Table of Contents

Game Description

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.

Screenshots

Windows terminal

windows terminal gameplay windows terminal game over

Linux terminals

  • Gnome terminal

gnome terminal gameplay

  • Kitty terminal

kitty board kitty gameplay

Installation

System Requirements

  • Python 3.8 or newer
  • Pip (Python package manager)

Windows

  1. Install Python:
    • Download and install Python 3.8 or newer from python.org
    • During installation, check "Add Python to environment variables"
  2. Open Command Prompt (cmd) as administrator
  3. Clone the repository and navigate to the project directory:
git clone <repository-url>
cd memory-game
  1. Create and activate virtual environment:
python -m venv venv
venv\Scripts\activate
  1. Install the game:
pip install .

Linux

  1. 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
  1. Clone the repository and navigate to the project directory:
git clone <repository-url>
cd memory-game
  1. Create and activate virtual environment:
python3 -m venv venv
source venv/bin/activate
  1. Install the game:
pip install .

Player Instructions

Running the Game

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

Gameplay

  1. The game begins with choosing the board size (max. 6x6)
  2. After selecting dimensions, a board with hidden cards appears
  3. Players take turns selecting two cards
  4. If the cards form a pair:
    • Player gets a point
    • Cards remain revealed
    • Player can make another move
  5. If the cards are different:
    • Cards are hidden again
    • Turn passes to the other player
  6. Game ends when all pairs are found

Additional Information

  • 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+p displays possible actions
  • Use Tab to navigate through the board and buttons
  • In case of any errors, please check the memory_game.log file in the directory from which the game is launched

Main Features

  • 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

Configuration

The game can be configured through an INI file containing the following sections:

[BOARD]

  • width - board width (number of cards)
  • height - board height (number of cards)

[SAVE_GAME]

  • 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.

[LOAD_GAME]

  • game_load_file - path to the file with saved game state
  • key_load_file - path to the file with encryption key for reading game state
  • load - 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

About

Classic memory game implemented as a console application βš™οΈ for two players. The game was created using modern Python 🐍 libraries, providing a pleasant user interface despite its console-based nature. πŸ˜‰

Topics

Resources

Stars

Watchers

Forks

Languages