Skip to content

juritox/slot-machine

Repository files navigation

Slot Machine Simulation

This is my first major project using Python classes and the Turtle module for graphics.

Project Overview

This project showcases:

  • Object-Oriented Programming (OOP): Utilizes classes to model different components of the slot machine.
  • Graphical User Interface (GUI): Implements a graphical user interface using Turtle graphics.
  • Game Mechanics: Simulates basic slot machine operations without real money involvement.
  • Logging: Logs game actions and outcomes to text files in simple or detailed mode.
  • Configuration: Allows easy customization of game parameters through a configuration file.
  • Error Handling: Implements validation to ensure proper configuration settings.
  • Cross-Platform Compatibility: Includes scripts for running the game on both Windows and Unix-based systems.

Game Showcase

Slot Machine

Installation Instructions

To set up and run this project locally, follow these steps:

Prerequisites

  • Ensure you have Python version 3.12 or higher installed on your machine.
  • Ensure you have pip installed for managing Python packages.

Install Dependencies

  • Ensure you have Python 3.12 and the Turtle module installed. Turtle is usually included with Python, but if you encounter any issues, you can install it via pip:
pip install PythonTurtle

Clone the Repository

Clone this repository to your local machine using:

git clone https://github.com/juritox/slot-machine.git

Running the Game

  • Windows Instructions: Simply navigate to the project directory and run the run_game_windows.bat script.

  • Unix-based Systems Instructions: Navigate to the project directory, ensure the run_game_unix.sh script is executable, and run it.

  • If the scripts fail to run the game you can run it directly inside the src directory and running main.py.

Modifying Game Settings

  • To customize how the game operates and adjust its basic settings, you can modify the config.py file located in the src directory.

  • Validation: Some values in config.py are validated when starting the game to ensure they are not set incorrectly. Any errors or issues will be logged to the console.

  • Advanced Configuration: Modifying the configuration is intended for advanced users. It is recommended to use an Integrated Development Environment (IDE) for Python when making changes. Proceed with caution to avoid misconfigurations that might affect game functionality.

Project Structure

  • src/: Contains the main Python scripts for the game.
  • assets/: Includes gifs and icons used in the game.
  • docs/: Will be used for project documentation.
  • logs/: Directory where game logs are stored.

Key Features

  • Customizable slot symbols and numbers
  • Adjustable win conditions and amounts
  • Jackpot functionality
  • Calculation of Return To Player (RTP)
  • Detailed logging for game events
  • Cross-platform compatibility

Understanding RTP (Return to Player)

RTP, or Return to Player, is an important concept in this slot machine simulation. It represents the percentage of wagered amount that a slot machine is designed to pay back to players over time.

Key points about RTP in this simulation:

  1. Definition: RTP is expressed as a percentage. For example, an RTP of 95% in the simulation means that for every 100 credits wagered, the machine is designed to return 95 credits on average.

  2. Long-term metric: RTP is calculated over a large number of plays. Short-term results in the simulation can vary from this average.

  3. Simulation mechanics: The difference between 100% and the RTP represents the designed advantage in the simulation. Unlike real slot machines, this simulation allows for customizable RTP values for educational purposes.

  4. Features in this project:

    • The simulation calculates and displays the RTP, providing transparency about the game's mechanics.
    • Users can modify parameters in config.py to set custom RTP values and observe how they affect game outcomes.
    • This feature helps in understanding the relationship between game settings and simulated results.
  5. Educational value: By including customizable RTP, this project demonstrates important concepts in game design, probability theory, and the effects of different payout rates on game behavior.

Remember, this is an educational simulation designed to explore programming concepts and game mechanics. It's not intended to represent or encourage real-world gambling activities.

License

This project is open source and available under the MIT license.

Important Notes

Educational Use Only: This simulation is intended solely for educational purposes. It does not involve real money gambling and is designed to help learners understand programming concepts and basic game mechanics.

Releases

No releases published

Packages

No packages published