Package: bigchin
DescriptionThis 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 itInnovationsUpdate 1.0 - Adding the Perform, system classUpdate 1.1 - Bug fixesUpdate 1.1.5 - Bug fixesUpdate 1.1.7 - Bug fixesUpdate 1.1.9 - Bug fixesUpdate 1.2 - Bug fixesUpdate 1.2.2 - Officially prepared moduleUpdate 1.2.6 - Adding the kalive classUpdate 1.2.8 - Adding exceptions to the kalive classUpdate 1.2.9 - Adding exceptions to the kalive class
UsingUsing 1.2.6This class of functions adds the ability to support your variables/applications in some partial elementsSupported list:Discord Bot aliveimportdiscordclient=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.0In the code below, you can make a small game that depends on luck. With this function, you can specify the chances of "winning" and returnTrue, or lose.frombigchinimportperformmy_chance=perform.perchance(50)# 50 - Your chancesifmy_chanceisTrue:print("Win!")elifmy_chanceisFalse:print("lose.")If you win, then you returnTrue. In case of defeat -FalseMaximum chances: 100Minimum chances: 0(Best of all - 1)In the next function you will be able to set yourmaximum unit of luckfrombigchinimportperformmy_custom_max_chance=200# 200 - Your any numbermy_chance=perform.perchances(my_custom_max_chance)ifmy_chance>50:print("Win!")elifmy_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 toTruefrombigchinimportperformmy_custom_max_chance=450# 450 - Your any numbermy_chance=perform.perchances(my_custom_max_chance,True)ifmy_chance>50:print("Win!")elifmy_chance<=50:print("lose.")In thesystemclass, it will be possible to view system functions or information in future updates.Version view (1)importbigchinversion=bigchin.system.ver()print(version)Version view (2)frombigchinimportsystemversion=system.ver()print(version)There is a small analogue of theperchancefunction. If you need to use several variables at once, then you can use the following functionfrombigchinimportperformmy_dict_chance=perform.permchance(10,20,40)# 10, 20, 40 - Your chancesprint(my_dict_chance)In the output we will getdictwith our variablesIf you are working on some game (Let's say daily-rewards), then you definitely need a system with acalculation of luck for a certain reward. In the next function you will be able to implement thisfrombigchinimportperformmy_chance=perform.СЃpermchance(30,60)# 30, 60 - Your chancesprint(my_chance)In the console, we will most likely see: -60Let'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СЃpermchancefunction simplifies this implementation. Here is an example code corresponding to our above-mentioned "game" designed for luck"frombigchinimportperformprobability_a_price_reward=10# 10%probability_of_usual_reward=90# 90 %result=perform.СЃpermchance(probability_a_price_reward,probability_of_usual_reward)ifresult==probability_a_price_reward:print("Win!")elifresult==probability_of_usual_reward:print("so-so...")That is, the probability for avaluable reward is 10%, and for anordinary, standard reward is 90%