mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Mines (#60)
* Add MinesCommand Add MinesCommand parses user input and submits it to mines service * Add KasinoMines service to bot services Add KasinoMines service to bot services * kasinomines service code kasinomines service code holds all the game information so that games can be ongoing, you can leave your game and come back to it later, * Update MinesCommand.cs * Update KasinoMines.cs * Update MinesCommand.cs * add house edge to limbo add house edge to limbo * add house edge to keno add house edge to keno * Update BotServices.cs forgot to add kasino mines item * Update BuiltIn.cs add kasinomines cleanup delay setting * Update KenoCommand.cs add difficulty options to keno, classic low medium high default high * Update PlanesCommand.cs adds house edge to planes if your buffs cause house edge to be greater than 1, you have a HOUSE_EDGE - 1.0 % chance to get a guaranteed win, if house edge is less than 1, 1-HOUSE EDGE chance for a guaranteed loss * Update PlanesCommand.cs missed a counter update * Update PlinkoCommand.cs plinko house edge update changes vacuum strength based on house edge
This commit is contained in:
@@ -34,6 +34,7 @@ public class LimboCommand : ICommand
|
||||
|
||||
private const double Min = 1;
|
||||
private const double Max = 10000;
|
||||
private decimal HOUSE_EDGE = (decimal)0.98;
|
||||
|
||||
public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments,
|
||||
CancellationToken ctx)
|
||||
@@ -119,10 +120,10 @@ public class LimboCommand : ICommand
|
||||
|
||||
//returns a distribution with a 1/multi chance of getting a number below or above sqr(min * max) (so max should basically be multi^2). basically gives you a 1/x fair chance to win
|
||||
//then scales the number using the number scaling function
|
||||
private static decimal[] Get1XWeightedRandomNumber(double minValue, double maxValue, decimal multi)
|
||||
private decimal[] Get1XWeightedRandomNumber(double minValue, double maxValue, decimal multi)
|
||||
{
|
||||
var random = RandomShim.Create(StandardRng.Create());
|
||||
var skew = 1.0 / (double)(multi * (decimal)1.01);
|
||||
var skew = 1.0 / (double)(multi);
|
||||
var gamma = Math.Log(0.5) / Math.Log(skew);
|
||||
var r = random.NextDouble();
|
||||
var rP = 1 - Math.Pow(1 - r, gamma);
|
||||
@@ -130,7 +131,7 @@ public class LimboCommand : ICommand
|
||||
var lnMax = Math.Log(maxValue);
|
||||
var exponent = lnMin + rP * (lnMax - lnMin);
|
||||
var result = new decimal[2];
|
||||
result[0] = (decimal)Math.Exp(exponent);
|
||||
result[0] = (decimal)Math.Exp(exponent) * HOUSE_EDGE;
|
||||
result[1] = GetScaledNumber(lnMin, lnMax, exponent, result[0], multi);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user