vacuum fix (#38)

vacuum fix
better plinko ball position setup if we ever want to add difficulty levels
This commit is contained in:
alogindtractor
2026-01-08 21:57:49 -08:00
committed by GitHub
parent 2570523c3e
commit f14d9281a9

View File

@@ -62,9 +62,9 @@ public class PlinkoCommand : ICommand
}; };
private static List<(int row, int col)> validPositions = []; private static List<(int row, int col)> validPositions;
private static Dictionary<int, List<int>> validColumnsForRow = new(); private static Dictionary<int, List<int>> validColumnsForRow;
public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments, public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments,
CancellationToken ctx) CancellationToken ctx)
@@ -198,9 +198,9 @@ public class PlinkoCommand : ICommand
ball.Iterate(); ball.Iterate();
} }
await Task.Delay(250); await Task.Delay(500);
await botInstance.KfClient.EditMessageAsync(plinkoMessageID.ChatMessageId!.Value,PlinkoBoardDisplay(ballsInPlay)); await botInstance.KfClient.EditMessageAsync(plinkoMessageID.ChatMessageId!.Value,PlinkoBoardDisplay(ballsInPlay));
await Task.Delay(250); await Task.Delay(500);
} }
var newBalance = await Money.NewWagerAsync(gambler.Id, wager*numberOfBalls, payout, WagerGame.Plinko, ct: ctx); var newBalance = await Money.NewWagerAsync(gambler.Id, wager*numberOfBalls, payout, WagerGame.Plinko, ct: ctx);
@@ -216,7 +216,7 @@ public class PlinkoCommand : ICommand
for (int row = 0; row < DIFFICULTY; row++) for (int row = 0; row < DIFFICULTY; row++)
{ {
for (int col = 0; col < DIFFICULTY * 2 - 1; col++) for (int col = 0; col < DIFFICULTY*2-1; col++)
{ {
spaceIsBall = false; spaceIsBall = false;
spaceIsValid = false; spaceIsValid = false;
@@ -262,7 +262,7 @@ public class PlinkoCommand : ICommand
public (int row, int col) POSITION; public (int row, int col) POSITION;
public PlinkoBall() public PlinkoBall()
{ {
POSITION = (0, DIFFICULTY - 1); POSITION = validPositions[0];
} }
public void Iterate() public void Iterate()
@@ -273,7 +273,7 @@ public class PlinkoCommand : ICommand
{ {
rng -= VACUUM; rng -= VACUUM;
} }
else if (POSITION.col > DIFFICULTY+1) else if (POSITION.col > DIFFICULTY-1)
{ {
rng += VACUUM; rng += VACUUM;
} }