This is my first major project using Python classes and the Turtle module for graphics.
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.
To set up and run this project locally, follow these steps:
- Ensure you have Python version 3.12 or higher installed on your machine.
- Ensure you have pip installed for managing Python packages.
- 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 this repository to your local machine using:
git clone https://github.com/juritox/slot-machine.git
-
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 runningmain.py
.
-
To customize how the game operates and adjust its basic settings, you can modify the
config.py
file located in thesrc
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.
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.
- 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
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.
-
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.
-
Long-term metric: RTP is calculated over a large number of plays. Short-term results in the simulation can vary from this average.
-
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.
-
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.
-
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.
This project is open source and available under the MIT license.
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.