Chess Tournament

Project information

  • GitHub URL: https://github.com/DoriDoro/Chess_Tournament
  • create date: Feb. 21, 2023
  • evaluation date: May 5, 2023
  • Skills:

    Python

    CLI (Command Line Interface) application

    Git

    GitHub

    MVC (Model-View-Controller) architecture

    Flake8

    PEP8

    Menu-navigation


Introduction

In this project, I developed a stand-alone, offline Chess Game application using Python. The program follows the Model-View-Controller (MVC) design pattern to separate concerns between data management, user interaction, and logic. It is a Command-Line Interface (CLI) application that allows users to navigate through various menu options for managing players and organizing tournaments.

Project Workflow:

      • MVC Structure: Separates the database, user interface, and logic for a clean, modular design.
      • CLI: Provides a simple, intuitive interface for users to manage players and tournaments from the terminal.
      • Menu Navigation: Allows users to interact with the program easily, enabling features like adding players, managing tournaments, and viewing rankings.
      • TinyDB Database: Uses a JSON file to store player and tournament data persistently.
      • Code Quality: Ensures adherence to Python's coding standards using flake8 and PEP8.
      • Cross-Platform: The program runs on Windows, Mac, and Linux with ease.

This project demonstrates how to build a robust, maintainable, and cross-platform Chess Game application using Python, while adhering to best practices in software design and code quality.


Competences

    • Model-View-Controller (MVC) pattern
    • build a CLI application
    • Menu to navigate through the Chess Game
    • database: TinyDB - JSON database
    • flake8
    • PEP8


Learning Experience

1. MVC (Model-View-Controller) Pattern

The program is structured using the MVC architecture to ensure that the code is modular and easy to maintain. The Model handles the database of players and tournaments, the View manages the display and input/output of the CLI, and the Controller manages the flow between the user input and the system's operations. This clear separation makes it easy to scale or modify the application in the future.

2. Command-Line Interface (CLI) Application

The application is entirely text-based and runs from the console using the command:

python3 main.py

It provides a menu-driven interface that allows users to navigate through various sections, such as adding players, starting tournaments, and viewing rankings. The CLI design ensures that the program runs smoothly across Windows, Mac, and Linux platforms.

3. Menu for Navigation

A key feature of the program is its user-friendly navigation menu, which guides users through various options related to the Chess Game:

      • Add new players to the database
      • Set up and manage tournaments
      • View and edit player rankings
      • Record match results This interactive menu ensures that users can perform actions intuitively and efficiently.

4. TinyDB JSON Database

The program uses TinyDB, a lightweight NoSQL database stored in JSON files. This ensures that the application can be run offline and still store player data persistently. Each player’s information, such as name, ranking, and tournament results, is stored in the database, allowing for easy retrieval and updates.

5. Code Quality: flake8 and PEP8 Compliance

To ensure clean and maintainable code, the project adheres to PEP8 standards, and flake8 is used to enforce these guidelines. This helps maintain readability and consistency throughout the codebase. The use of private functions ensures that sensitive operations are encapsulated, while common functions are reused where necessary to avoid redundancy.

6. Requirements File

The project includes a requirements.txt file that lists all the dependencies needed to run the program. Users can easily set up the environment by installing the required dependencies via:

pip install -r requirements.txt

This guarantees that the program can be run smoothly on any system, regardless of the operating system.

Designed by BootstrapMade and modified by DoriDoro