Skip to main content

A small library for your projects

Project description

Description

This small library contains some useful functions that you would need in the implementation of projects. Every time the library is updated, and many other useful functions are added to it

Innovations

Update 1.0 - Adding the Perform, system class


Update 1.1 - Bug fixes


Update 1.1.5 - Bug fixes


Update 1.1.7 - Bug fixes


Update 1.1.9 - Bug fixes


Update 1.2 - Bug fixes


Update 1.2.2 - Officially prepared module


Update 1.2.6 - Adding the kalive class

Using

Using 1.2.6

This class of functions adds the ability to support your variables/applications in some partial elements

Supported list:

  • Discord Bot alive
import discord
client = commands.Bot()
token = "123X456"
kalive("discord.Client").checkalive(client, token)

Thus, if you maintain the state of your Discord bot using the Flash module (keep alive), then this kalive function will handle exceptions and errors in your token or bot startup.

Using 1.0

In the code below, you can make a small game that depends on luck. With this function, you can specify the chances of "winning" and return True, or lose.

from bigchin import perform
my_chance = perform.perchance(50) # 50 - Your chances
if my_chance is True:
    print("Win!")
elif my_chance is False:
    print("lose.")

If you win, then you return True. In case of defeat - False Maximum chances: 100 Minimum chances: 0 (Best of all - 1)

In the next function you will be able to set your maximum unit of luck

from bigchin import perform
my_custom_max_chance = 200 # 200 - Your any number
my_chance = perform.perchances(my_custom_max_chance)
if my_chance > 50:
    print("Win!")
elif my_chance <= 50:
    print("lose.")

If you are working with a large and important project, and you choose numbers as the maximum size, except for the standard ones [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], then you will have to quickly enter into the console - "y" (Operation confirmation).

As we know, if you specify the number of the maximum size of the odds except [100, 200, 300, 400, 500, 600, 700, 800, 900, 100], then you will have a warning where confirmation of the operation is required. To skip it, set an additional parameter to True

from bigchin import perform
my_custom_max_chance = 450 # 450 - Your any number
my_chance = perform.perchances(my_custom_max_chance, True)
if my_chance > 50:
    print("Win!")
elif my_chance <= 50:
    print("lose.")

In the system class, it will be possible to view system functions or information in future updates.

Version view (1)

import bigchin
version = bigchin.system.ver()
print(version)

Version view (2)

from bigchin import system
version = system.ver()
print(version)

There is a small analogue of the perchance function. If you need to use several variables at once, then you can use the following function

from bigchin import perform
my_dict_chance = perform.permchance(10, 20, 40) # 10, 20, 40 - Your chances
print(my_dict_chance)

In the output we will get dict with our variables

If you are working on some game (Let's say daily-rewards), then you definitely need a system with a calculation of luck for a certain reward. In the next function you will be able to implement this

from bigchin import perform
my_chance = perform.СЃpermchance(30, 60) # 30, 60 - Your chances
print(my_chance)

In the console, we will most likely see: - 60

Let's say you need a program for determining the luck of some boxing, case (gaming) that are designed only on luck. The most expensive rewards will be likely with 10% chances (for example), and the most ordinary ones with 90%. The СЃpermchance function simplifies this implementation. Here is an example code corresponding to our above-mentioned "game" designed for luck"

from bigchin import perform
probability_a_price_reward = 10 # 10%
probability_of_usual_reward = 90 # 90 %
result = perform.СЃpermchance(probability_a_price_reward, probability_of_usual_reward)
if result == probability_a_price_reward:
    print("Win!")
elif result == probability_of_usual_reward:
    print("so-so...")

That is, the probability for a valuable reward is 10%, and for an ordinary, standard reward is 90%

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bigchin-1.2.8.tar.gz (4.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page