Code Monkey home page Code Monkey logo

axbecher / portal_gaming_hub_python Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 11 KB

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.

License: MIT License

Python 100.00%
color-support console-app console-application console-game datetime guess-the-number guessing-game json json-schema number-guessing-game

portal_gaming_hub_python's Introduction

Table of Contents

  1. Portal Gaming Hub - Console Version
  2. Tutorial
  3. How does it work
  4. For the program to work correctly
  5. Requirements
  6. Configuration
  7. Contributors
  8. Usage
  9. Support
  10. License

Portal Gaming Hub - Console Version

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.

Tutorial

Portal Gaming Hub in Console

How does it work:

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

For the program to work correctly:

  • 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

Requirements

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

Configuration

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
            }
        }
    }
}

Contributors ✨

Thanks go to these wonderful people:

Alexandru Becher
Alexandru Becher

Usage

  1. To run the script, use the following command in your terminal:
python main.py
  1. Double click on main.py and console will pop up.

Support

For any questions or support, please contact me via https://axbecher.com/contact/

License

This project is licensed under the MIT License.

portal_gaming_hub_python's People

Contributors

axbecher avatar iceflamesstudio avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.