private void PerformAction(PlayerAction choice, Player player, Pot pot) { switch (choice) { case PlayerAction.Check: break; case PlayerAction.Bet: Bet(player, pot); break; case PlayerAction.Call: Call(player, pot); break; case PlayerAction.Raise: Raise(player, pot); break; case PlayerAction.Fold: Fold(player); break; default: throw new ArgumentOutOfRangeException(nameof(choice), choice, null); } }
public CheckGuess(BattleManager _bm, Stats _plStats, EnemyBattleData _npcData, PlayerHand _plrHnd, NPCHand _npcHnd, bool _isChallenged) : base(_bm, _plStats, _npcData, _plrHnd, _npcHnd) { name = Phases.GuessCheck; isCurrentPlayerChallenged = _isChallenged; pot = battleManager.pot; }
private void UpdatePot(int tableId) { var players = Games.First(e => e.TableId == tableId) .Players.Where(player => player.RoundBet > 0 && player.ActionState == PlayerActionState.Playing) .ToList(); while (players.Any()) { var pot = new Pot { PotAmount = players.Min(e => e.RoundBet) }; foreach (var player in players) { player.RoundBet -= pot.PotAmount; pot.Players.Add(player.Name); } pot.PotAmount *= players.Count; if (Games.First(e => e.TableId == tableId).Winnings .Count(winningPot => winningPot.Players.SetEquals(pot.Players)) > 0) { Games.First(e => e.TableId == tableId).Winnings.First(e => e.Players.SetEquals(pot.Players)).PotAmount += pot.PotAmount; } else { Games.First(e => e.TableId == tableId).Winnings.Add(pot); } players = players.Where(e => e.RoundBet > 0).ToList(); } }
// method to remove the pot public Pot RemovePot() { Pot pot = Pot; Pot = null; return(pot); }
private PlayerAction PlayerAct(List <Player> players, Player player, Pot pot) { var isBetPlaced = pot.CurrentBet != 0; var actionTaken = _actionService.Act(player, pot, isBetPlaced); return(actionTaken); }
private double CalculatePotOdds(Pot pot, double raise) { double cost = pot.GetCallCost(player) + raise; double potSize = pot.GetPotSize(); double potOdds = cost / (cost + potSize); return potOdds; }
// Use this for initialization void Start() { this.state = MACHINE_STATE.OFF; this.energyLevel = 0; this.operatedHours = 0; this.pot = new Pot(); }
public static Pot CreatePot(int id, int tripId, string organizer = "orga", PotMode mode = PotMode.Lead, double amount = 1000, double targetAmount = 2000, string name = "PotName", DateTime?startDate = null, DateTime?endDate = null, DateTime?validityDate = null, string description = "TestDesc", bool isCancelled = false, string cancellationReason = "Reason", DateTime?cancellationDate = null, DateTime?modificationDate = null) { var valStart = startDate.HasValue ? startDate.Value : DateTime.Today; var valEnd = endDate.HasValue ? endDate.Value : DateTime.Today; var valValidity = validityDate.HasValue ? validityDate.Value : DateTime.Today; var valModifDate = modificationDate.HasValue ? modificationDate.Value : DateTime.Today; var pot = new Pot ( id, tripId, organizer, mode, amount, targetAmount, name, valStart, valEnd, valValidity, description, isCancelled, cancellationReason, cancellationDate ); pot.ModificationDate = valModifDate; return(pot); }
//https://en.wikipedia.org/wiki/Blind_(poker)#:~:text=The%20blinds%20are%20forced%20bets,range%20from%20none%20to%20three. public void BlindBets(Player smallBlind, Player bigBlind, int blindAmount, Pot pot) { var smallBlindPrice = DetermineSmallBlindPrice(blindAmount); smallBlind.AddToPot(smallBlindPrice, pot); bigBlind.AddToPot(blindAmount, pot); }
private void AttemptFoodTransfer(Pot pot) { //Debug.Log($"Attempt food transfer from {pot.name}"); // check empty plate and pot food ready if (hasFood || !pot.IsFoodReady()) { return; } // check pot is tilted over plate (dot product with 'up' vectors) bool potTilted = Vector3.Dot(pot.transform.up, Vector3.up) < 0f; if (!potTilted) { return; } // create content in plate this.content = pot.GetPotContent(); foodObject.SetActive(true); foodObject.transform.localScale = Vector3.zero; foodObject.transform.DOScale(Vector3.one, 0.3f); // reset pot pot.Reset(); // trigger plate content changed event for UI ContentChanged?.Invoke(content); }
public override void Bet(Deck deck, Board board, Pot pot, ArrayList players) { ArrayList peekedHands = pokerAI.PeekHands(players); currentHandStrength = HandStrengthEvaluator.EvaluateHandStrength( hand, board.GetCards(), peekedHands, deck); pokerAI.Bet(currentHandStrength, pot); }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.name == "cooker" && transform.gameObject.name != "plate") { Destroy(transform.gameObject); soup = collision.transform.Find("soup"); if (soup) { Vector3 soupScale = soup.localScale; soupScale.y += 0.05f; soup.localScale = soupScale; Debug.Log("soup now rise!"); if (soup.localScale.y >= 0.15f) { Pot pot = collision.gameObject.GetComponent <Pot>(); pot.MakeANewDish(soup); Destroy(soup.gameObject); } } else { soup = GameObject.CreatePrimitive(PrimitiveType.Cylinder).transform; soup.parent = collision.transform; soup.localScale = new Vector3(0.9f, 0.05f, 0.9f); soup.name = "soup"; soup.GetComponent <Renderer>().material.color = new Color(0, 0, 1, 1); soup.localPosition = Vector3.zero; Debug.Log(soup); } } }
public void OutputPot(Pot pot) { AnsiConsole.Render(new Table() .AddColumn("[lightseagreen bold]Pot Total[/]") .AddColumn("[darkseagreen1 bold]Last Bet[/]") .AddRow(pot.Chips.ToString(), pot.CurrentBet.ToString())); }
public SetupStage(Deck deck, Pot pot, Board board, ArrayList players) { this.deck = deck; this.pot = pot; this.board = board; this.players = players; }
public PlayerAction[] DetermineAvailableActions(Player player, Pot pot) { var availableActions = new List <PlayerAction> { PlayerAction.Fold }; var isInDebt = player.CurrentBet < pot.CurrentBet; var isBetPlaced = pot.CurrentBet > 0; if (!isInDebt) { availableActions.Add(PlayerAction.Check); if (CanPlayerBet(player) && !isBetPlaced) { availableActions.Add(PlayerAction.Bet); } } else if (CanPlayerCall(player, pot)) { availableActions.Add(PlayerAction.Call); } if (CanPlayerRaise(player, pot) && isBetPlaced) { availableActions.Add(PlayerAction.Raise); } return(availableActions.ToArray()); }
public GameForm() { this.InitializeComponent(); this.timer.Interval = 1000; this.timer.Tick += this.TimerTick; this.updates.Interval = 100; this.updates.Tick += this.UpdateTick; this.textboxBigBlind.Visible = false; this.textboxSmallBlind.Visible = false; this.buttonBigBlind.Visible = false; this.buttonSmallBlind.Visible = false; this.textboxRaise.Text = (AppSettigns.DefaultMinBigBlind * 2).ToString(); IPlayer human = this.GetHumanPlayer(); IAILogicProvider logicProvider = new AILogicProvider(); ICollection <IAIPlayer> enemies = this.GetEnemies(logicProvider); IPot pot = new Pot(this.textboxPot); IDealer dealer = this.GetDealer(); IDeck deck = Deck.Instance; this.messageWriter = new MessageBoxWriter(); IHandTypeHandler handTypeHandler = new HandTypeHandler(); this.engine = new GameEngine(human, enemies, pot, dealer, deck, this.messageWriter, handTypeHandler); this.engine.GameEngineStateEvent += this.ChangeGameEngineStateHandler; this.updates.Start(); this.engine.Run(); }
public override void TouchedByPot(Pot other) { if (other.isFlying) { TouchedByWeapon(other); } }
private void finishHand() { var handStrengths = new List <int>(); foreach (var botGameState in _botGameStates) { if (_botGameStates[0].getBoard().Count == 5) // TODO CHeeeeeeeeeeck { var handStrength = botGameState.calculateHeroHandStrength(); handStrengths.Add(handStrength.Value()); } else { handStrengths.Add(0); } } var winnings = Pot.calculateWinnings(getPlayers(), handStrengths); for (int i = 0; i < winnings.Count; i++) { if (winnings[i] > 0) { var player = getPlayers()[i]; _gameTableControl.log(player.Name + " wins " + moneyToString(winnings[i])); } } foreach (var botGameState in _botGameStates) { botGameState.finishHand(winnings); } _opponentModeling.addHand(_botGameStates[0].getCurrentHand()); }
private void CallOrNotCall(double handStrength, Pot pot) { double potOddsForCall = CalculatePotOdds(pot, 0); double rateOfReturnForCall = handStrength / potOddsForCall; int d100 = D100(); if (rateOfReturnForCall < 0.8){ FoldOrBluff(handStrength, pot); } else if (rateOfReturnForCall < 1.0){ // PL: More agressinve player with not so good hands? if (d100 >= Mathf.Min(95, playingSkill)){ FoldOrBluff(handStrength, pot); } else if (d100 >= Mathf.Min(85,playingSkill)){ CallOrRaise(handStrength, pot); } else { Debug.Log("PokerAI.CallOrNotCall(), not calling CallOrRaise() or FoldOrBluff(). Is this OK?"); } /* if (d100 <95){ FoldOrBluff(handStrength, pot); } else if (d100 < 85){ CallOrRaise(handStrength, pot); } */ } else if (rateOfReturnForCall < 1.3){ CallOrRaise(handStrength, pot); } else { CallOrRaise(handStrength, pot); } }
public GetTurnContext( GameRoundType roundType, IReadOnlyCollection <PlayerActionAndName> previousRoundActions, int smallBlind, int moneyLeft, int currentPot, int myMoneyInTheRound, int currentMaxBet, int minRaise, Pot mainPot, List <Pot> sidePots, ICollection <Opponent> opponents) { this.RoundType = roundType; this.PreviousRoundActions = previousRoundActions; this.SmallBlind = smallBlind; this.MoneyLeft = moneyLeft; this.CurrentPot = currentPot; this.MyMoneyInTheRound = myMoneyInTheRound; this.CurrentMaxBet = currentMaxBet; this.MinRaise = minRaise; this.MainPot = mainPot; this.SidePots = sidePots; this.Opponents = opponents; }
private void UsePot(Pot pot) { foreach (BuffInstance buff in ObjectManager.Player.Buffs) { Console.WriteLine(buff.Name); if (buff.Name.Contains(pot.Buff)) { return; } } if (pot.LastTime + 5 > Game.Time) { return; } if (!Items.HasItem(pot.Id)) { return; } if (!Items.CanUseItem(pot.Id)) { return; } Items.UseItem(pot.Id); pot.LastTime = Game.Time; }
public override string ToString() { string toString = this.GetType().ToString() + "{ "; #region Players toString += "Players{ "; for (int i = 0; i < this.Players.Length; i++) { toString += ((this.Players[i] == null) ? "EMPTY" : this.Players[i].Name); if (i != this.Players.Length - 1) { toString += ", "; } } toString += " }"; #endregion toString += Deck.ToString() + TableCards.ToString() + BurnCards.ToString() + "Pot{ " + Pot.ToString() + " }" + "Minimum Denomination{ " + MinimumDenomination.ToString() + " }" + "Low Blind{ " + LowBlind.ToString() + " }" + "High Blind{ " + HighBlind.ToString() + " }"; toString += " }"; return(toString); }
private static List <Pot> UpdatePots(IReadOnlyCollection <Note> notes, List <Pot> pots) { var updatedPots = new List <Pot>(); for (var index = 0; index < pots.Count; index++) { var leftEdgeIndex = index - 2; var leftIndex = index - 1; var rightIndex = index + 1; var rightEdgeIndex = index + 2; var leftEdge = pots.ElementAtOrDefault(leftEdgeIndex)?.Plant ?? '.'; var left = pots.ElementAtOrDefault(leftIndex)?.Plant ?? '.'; var right = pots.ElementAtOrDefault(rightIndex)?.Plant ?? '.'; var rightEdge = pots.ElementAtOrDefault(rightEdgeIndex)?.Plant ?? '.'; var pot = pots[index]; var pattern = $"{leftEdge}{left}{pot.Plant}{right}{rightEdge}"; var updatedPot = new Pot(pot.Index, notes.FirstOrDefault(n => n.Pattern == pattern)?.Result ?? '.'); updatedPots.Add(updatedPot); } pots = updatedPots; var lastPot = pots.Last(); updatedPots.Add(new Pot(lastPot.Index + 1, '.')); return(pots); }
public override void WeaponTouchedByPot(Pot other) { if (other.isFlying) { // handle differently maybe TouchedByWeapon(other); } }
public void CurrentFlowerGet_OfNewPot_ReturnsNull() { // arrange var pot = new Pot(); // assert Assert.AreEqual(null, pot.CurrentFlower); }
public void CallMinimumBet(Pot pot) { //if (stack < pot.GetCallCost(this)){ // Fold(pot); //} else { Call(pot); //} }
public void IsEmptyGet_NewPot_IsTrue() { // arrange var pot = new Pot(); // assert Assert.AreEqual(true, pot.IsEmpty(DateTime.UtcNow)); }
public BetAction(GameObject actor, string text, Pot pot) : base(actor) { InitAnimationInfo("bet", WrapMode.Once, Emotion.BodyParts.FACE); InitInteractionInfo(false, false, false); this.text = text; this.pot = pot; }
public static Pot CapturePotProperties(Pot pot) { CaptureProductProperties(pot); CaptureMaterial(pot); return(pot); }
public void RegisterPot(Pot pot) { int index = ItemList.Count; ItemList.Add(pot); PotIndexList.Add(index); pot.ID = index; }
public BettingRoundStage(Deck deck, Board board, Pot pot, ArrayList players, PokerPlayer dealer) { this.deck = deck; this.board = board; this.pot = pot; this.players = players; currentPlayer = dealer; }
public override void OnDrop(GameObject dropped) { sound.Play(); full = true; dropped.GetComponent <Animator>().SetBool("Plated", true); dropped.GetComponent <Pot>().table = this; pot = dropped.GetComponent <Pot>(); }
void FixedUpdate() { if (!waitAFrame) { TouchingPot = null; } waitAFrame = false; }
public MinimumBetsStage(Pot pot, ArrayList players, PokerPlayer dealer) { this.pot = pot; this.players = players; this.dealer = dealer; currentPlayer = dealer; firstDone = false; }
void Start() //pozicija na krivulji, 0 - 1 0=zacPoint, 1=konPoint { vseTocke = gameObject.AddComponent <Pot> (); vseTocke.izgradiPot(root); //zgradimo pot vseTocke = vseTocke.dodajDaljico(rootDaljice, rootDaljiceDesno, vseTocke); //v pot dodamo daljico s konstruktorjem ki delo opravi za nas //vseTocke.narisiVsePoti (tockaPot); vseTocke.narisiPot(tockaPotIzbrana); }
public TurnEnd(BattleManager _bm, Stats _plStats, EnemyBattleData _npcData, PlayerHand _plrHnd, NPCHand _npcHnd, bool _isWon) : base(_bm, _plStats, _npcData, _plrHnd, _npcHnd) { name = Phases.EndTurn; isChallengeWon = _isWon; table = battleManager.table; pot = battleManager.pot; infoCard = System.Array.Find(battleManager.infoCardsPrefabs, c => c.cardType == InfoType.TurnEnd); }
private void Start() { potFull = false; pot2Full = false; pot3Full = false; ps = pot.GetComponent <Pot>(); ps2 = pot2.GetComponent <Pot>(); ps3 = pot3.GetComponent <Pot>(); }
public override void Fold(Pot pot) { betting = false; if (pot.GetCallCost(this) > 0){ pot.Fold(this); } else { pot.Call(this); } }
public PlayerAction Act(Player player, Pot pot, bool isBetPlaced) { var availableActions = _actionProvider.DetermineAvailableActions(player, pot); var choice = GetPlayerAction(availableActions, player); PerformAction(choice, player, pot); return(choice); }
public PCPokerAction(GameObject actor, GameObject opponent, string waypointName, bool withMoney) : base(actor, waypointName, withMoney) { Debug.Log("PCPokerAction.PCPokerAction(" + actor.name + "," + opponent.name + "," + waypointName + "," + withMoney + ")"); this.opponent = opponent; this.withMoney = withMoney; betting = false; pot = null; raise = 0; }
public override void Call(Pot pot) { int cost = pot.Call(this); if (cost > 0){ QueueAction(new BetAction(actor, "I call.", pot), true); } else { QueueAction(new NoBetAction(actor, "I call."), true); } stack -= cost; busy = true; }
public ShowDownStage(Board board, Pot pot, ArrayList players, PCPokerAction pcPlayer) { this.pot = pot; this.board = board; this.players = players; this.pcPlayer = pcPlayer; buttonPressed = false; winnerName = null; loserName = null; winningHand = null; losingHand = null; isDraw = false; showDownDone = false; }
private Pot GetPot() { Pot pot = new Pot(); this.cookingLog.Add("A developer makes soup (Episode I - Invisible Threat)"); this.cookingLog.Add(string.Format("Took a clean {0}. (What do they mean by 'clean'?)", pot)); return pot; }
public override void Raise(Pot pot, int amount, bool isMinimumBet) { betting = false; stack -= pot.Raise(this, amount); pot.UpdateChips(); }
public abstract void Call(Pot pot);
public abstract void Fold(Pot pot);
private void InstanceStartPoker(PCPokerAction pcAction, GameObject npc, bool withMoney) { this.withMoney = withMoney; players = new ArrayList(); this.pcAction = pcAction; players.Add(pcAction); npcAction = new PokerAction(npc, "Poker Chair: Ed", withMoney); ActionRunner npcActionRunner = (ActionRunner)npc.GetComponent("ActionRunner"); npcActionRunner.ResetRoutine(npcAction, false); players.Add(npcAction); deck = new Deck(); pot = new Pot(players, table.GetPotHook()); board = new Board(table.GetBoardHooks()); InitStages(); running = true; playAgain = false; enabled=true; }
public static bool Initialize(ref GameData gData) { try { // targetForm = _targetForm; gameData = gData; SpadesPlayer = gData.CurrentPlayerList;//spadesPlayer; Pot = gData.CurrentPot; } catch (Exception ex) { string message = ex.Message; return false; } return true; }
private void Bluff(Pot pot) { player.Raise(pot, (int)GetBluff(pot), false); }
public override void Fold(Pot pot) { if (pot.GetCallCost(this) > 0){ QueueAction(new NoBetAction(actor, "I fold."), true); pot.Fold(this); busy = true; } else { Call(pot); } }
public override void Bet(Deck deck, Board board, Pot pot, ArrayList players) { raise = 0; this.pot = pot; betting = true; }
private double GetBluff(Pot pot) { double multiplier = (double)Random.Range(1.5f, 2.5f); return ((int)(multiplier * pot.GetHighestBet() / RAISE_STEP)) * RAISE_STEP; }
private double GetRaise(double handStrength, Pot pot, double raiseSoFar) { double higherRaise = raiseSoFar + RAISE_STEP; double potOddsForHigher = CalculatePotOdds(pot, higherRaise); double rateOfReturnForHigher = handStrength / potOddsForHigher; if (raiseSoFar > pot.GetHighestBet()){ if (D100() < 40){ return raiseSoFar; } } int d100 = D100(); if (rateOfReturnForHigher < 1.0){ if (d100 < 95){ return raiseSoFar; } else { return GetRaise(handStrength, pot, higherRaise); } } else if (rateOfReturnForHigher < 1.3){ if (d100 < 30){ return raiseSoFar; } else { return GetRaise(handStrength, pot, higherRaise); } } else { if (d100 < 5){ return raiseSoFar; } else { return GetRaise(handStrength, pot, higherRaise); } } }
public override void Raise(Pot pot, int amount, bool isMinimumBet) { string text; amount = (int)Mathf.Min(amount, pot.GetMaximumFairRaise(this)); if (amount == 0){ Call(pot); } else { if (isMinimumBet){ text = "Starting bets " + amount + ", okay?"; } else { text = "I raise by " + amount + "!"; } int cost = pot.Raise(this, amount); QueueAction(new BetAction(actor, text, pot), true); stack -= cost; busy = true; } }
// Use this for initialization void Start() { pot = GameObject.Find("BonsaiPot_FTexturing").GetComponent<Pot>(); }
private void CallOrRaise(double handStrength, Pot pot) { double amountToRaise = GetRaise(handStrength, pot, 0.0); if (amountToRaise == 0.0){ player.Call(pot); } else { player.Raise(pot, (int)amountToRaise, false); } }
public override void Call(Pot pot) { betting = false; stack -= pot.Call(this); pot.UpdateChips(); }
private void FoldOrBluff(double handStrength, Pot pot) { double rateOfReturnForCall = handStrength / CalculatePotOdds(pot, 0); int d100 = D100(); //Debug.Log("PokerAI.FoldOrBluff() rateOfReturnForCall=" + rateOfReturnForCall + " D100=" + d100 + "----------------------------"); // Trying to make Ed more aggressive bluffer when drunk... int defaulfChange=85; if (rateOfReturnForCall < 0.8){ defaulfChange = 95; } if (d100 >= Mathf.Min(defaulfChange, playingSkill)){ //Debug.Log("-- Bluff " + defaulfChange + ", playingSkill=" + playingSkill + " using: " + Mathf.Min(defaulfChange, playingSkill)); Bluff(pot); } else { //Debug.Log("-- Fold " + defaulfChange); player.Fold(pot); } /*if (rateOfReturnForCall < 0.8){ if (d100 < 95){ player.Fold(pot); } else { Bluff(pot); } } else { if (d100 < 85){ player.Fold(pot); } else { Bluff(pot); } }*/ }
void UsePot(Pot pot) { foreach (var buff in ObjectManager.Player.Buffs) { Console.WriteLine(buff.Name); if (buff.Name.Contains(pot.Buff)) { return; } } if (pot.LastTime + 5 > Game.Time) return; if (!Items.HasItem(pot.Id)) return; if (!Items.CanUseItem(pot.Id)) return; Items.UseItem(pot.Id); pot.LastTime = Game.Time; }
public void Bet(double handStrength, Pot pot) { CallOrNotCall(handStrength, pot); //TextInterface.ask(""); }