- Portal Gaming Hub - Console Version
- Tutorial
- How does it work
- For the program to work correctly
- Requirements
- Configuration
- Contributors
- Usage
- Support
- License
This code implements a number guessing mini-game, which can be run from the command line. The user navigates through menus to select a platform and then a game, after which they must guess a number within a randomly generated interval while receiving clues about the current interval. The game stores information such as the last time it was played and the current interval limits.
Additionally, the "main_menu" function displays a series of options and has a different color scheme based on ANSI escape characters if it is run on a Windows operating system with color support.
- The code imports several libraries: json, time, random, datetime, os, and platform.
- It then checks the type of platform and enables color support on the command prompt if the platform is Windows.
- The main_menu function clears the console and prints out some options.
- The platforms_menu function clears the console and prints out a list of available platforms. It then prompts the user to select a platform and returns the available games for that platform.
- The games_menu function clears the console and prints out a list of available games. It then prompts the user to select a game and starts a mini-game where the user has to guess a randomly generated number within a certain range.
- The generate_number function generates a new random number each time it is called, within a certain range determined by the time since the last time the game was played.
- The countdownMiniGame function is called to give a short countdown before displaying the next message.
- Ensure that you have all the requirements.txt installed. ( pip install -r requirements.txt )
- Make sure that you have selected the correct path in game_location, in platforms.json
Python 3.6 or later Required packages listed in requirements.txt To install the required packages, run the following command in your terminal:
pip install -r requirements.txt
The script requires path in order to execute .exe files that will be mention in platforms.json, field "game_location".
Example of platforms.json
For example game League of Legends
{
"Riot Games": {
"platform_name_suggestion": "Try playing a game outside instead of playing Steam games.",
"available_games": {
"League of Legends": {
"suggestion": "Why not go for a walk in the park instead of playing League of Legends?",
"game_location": "C:\\Riot Games\\League of Legends\\LeagueClient.exe",
"last_played": 1676827442.9226286
}
}
}
}
Thanks go to these wonderful people:
Alexandru Becher |
- To run the script, use the following command in your terminal:
python main.py
- Double click on main.py and console will pop up.
For any questions or support, please contact me via https://axbecher.com/contact/
This project is licensed under the MIT License.