Lambchop fix (#90)

* Enabling/disabling gamba games with dynamic settting lookup.

* shadow wizard lambchop gang, we love fixing upper bound errors

* dsfgrgfds
This commit is contained in:
CrackmaticSoftware
2026-02-21 00:29:39 +01:00
committed by GitHub
parent 66f2af5f52
commit 6b6bfe2699

View File

@@ -332,9 +332,19 @@ public class LambchopCommand : ICommand
double riggingFactor = Money.GetRandomDouble(gambler);
if (_houseEdge > 0 && riggingFactor < _houseEdge * 2) // shitty hack because I made the decision to clamp houseEdge to max 50%
{
// More rigging means death tile is more likely near the end
int minDeathTile = Math.Max(0, FIELD_LENGTH - 3);
return Money.GetRandomNumber(gambler, minDeathTile, FIELD_LENGTH); // return 15 means dying on the last tile xd
// Player fails - calculate where the death tile appears
double riggingFactor = Money.GetRandomDouble(gambler);
if (_houseEdge > 0 && riggingFactor < _houseEdge * 2) // shitty hack because I made the decision to clamp houseEdge to max 50%
{
// More rigging means death tile is more likely near the end
int minDeathTile = Math.Max(0, FIELD_LENGTH - 3);
return Money.GetRandomNumber(gambler, minDeathTile, FIELD_LENGTH, incrementMaxParam:false); // return 15 means dying on the last tile xd
}
else
{
// Player fail, random tile in the path becomes death tile
return Money.GetRandomNumber(gambler,0, FIELD_LENGTH, incrementMaxParam:false);
}
}
// Player fail, random tile in the path becomes death tile
@@ -344,12 +354,12 @@ public class LambchopCommand : ICommand
// Tiles 1 - 15
if (_houseEdge < 0.015)
{
int deathTile = Money.GetRandomNumber(gambler,-1, FIELD_LENGTH); // can be any tile, including no tile! (result -1 to FIELD_LENGTH (-1 - 15))
int deathTile = Money.GetRandomNumber(gambler,-1, FIELD_LENGTH, incrementMaxParam:false); // can be any tile, including no tile! (result -1 to FIELD_LENGTH (-1 - 15))
return deathTile;
}
// game is rigged, manipulate tile placement
int fairDeathTile = Money.GetRandomNumber(gambler,-1, FIELD_LENGTH);
int fairDeathTile = Money.GetRandomNumber(gambler,-1, FIELD_LENGTH, incrementMaxParam:false);
fairDeathTile = fairDeathTile == -1 ? FIELD_LENGTH + 1 : fairDeathTile; // shit hack, -1 means no death tile, change it to FIELD_LENGTH + 1 to compensate for next check.
bool wouldSucceedFairly = fairDeathTile > targetTile;
fairDeathTile = fairDeathTile == FIELD_LENGTH + 1 ? -1 : fairDeathTile;
@@ -365,9 +375,11 @@ public class LambchopCommand : ICommand
// extra rigged fail, choose tile just before target tile
return targetTile > 1 ? targetTile - 1 : 1;
}
// rigging failed, normal tile return
return Money.GetRandomNumber(gambler,-1, targetTile);
else
{
// rigging failed, normal tile return
return Money.GetRandomNumber(gambler,-1, targetTile, incrementMaxParam:false);
}
}
return fairDeathTile;
@@ -381,7 +393,7 @@ public class LambchopCommand : ICommand
// Place death tile closer to target
// higher house edge = more likely to place closer
int minTile = Math.Max(0, targetTile - 3);
return Money.GetRandomNumber(gambler,minTile, targetTile);
return Money.GetRandomNumber(gambler,minTile, targetTile, incrementMaxParam:false);
}
return fairDeathTile;
}