public Deck(PokerTable table) { this.deck = new Dictionary<int, ICard>(); this.holder = new PictureBox[52]; this.table = table; this.InitializeDeck(); }
private static void AddTestData(PokerTableContext context) { var table = new PokerTable { TableState = TableStates.Registering }; context.PokerTables.Add(table); context.SaveChanges(); var player1 = new Player { Name = "Player1", Token = Guid.NewGuid(), HoleCards = "AsAd", TableId = table.Id }; context.Players.Add(player1); var player2 = new Player { Name = "Player2", Token = Guid.NewGuid(), HoleCards = "KsKd", TableId = table.Id }; context.Players.Add(player2); context.SaveChanges(); }
public Deck(PokerTable table) { this.deck = new Dictionary <int, ICard>(); this.holder = new PictureBox[52]; this.table = table; this.InitializeDeck(); }
public StudFirstBettingRoundModule(PokerGameObserver o, PokerTable table) : base(o, table) { Variant = Table.Variant as AbstractStudGameVariant; if (Table.Params.Options.OptionType != GameTypeEnum.StudPoker || Variant == null) throw new Exception("This should only used with STUD games."); }
public override IEnumerable<IGameModule> GetModules(PokerGameObserver o, PokerTable t) { //Preflop yield return new DealMissingCardsToPlayersModule(o, t, NbCardsInHand); yield return new FirstBettingRoundModule(o, t); yield return new CumulPotsModule(o, t); //Flop yield return new DealCardsToBoardModule(o, t, 3); yield return new BettingRoundModule(o, t); yield return new CumulPotsModule(o, t); //Discard 2 to go back to 2 hole cards yield return new DiscardRoundModule(o, t, 2, 2); //Turn yield return new DealCardsToBoardModule(o, t, 1); yield return new BettingRoundModule(o, t); yield return new CumulPotsModule(o, t); //River yield return new DealCardsToBoardModule(o, t, 1); yield return new BettingRoundModule(o, t); yield return new CumulPotsModule(o, t); }
public override IEnumerable <IGameModule> GetModules(PokerGameObserver o, PokerTable t) { //Preflop yield return(new DealMissingCardsToPlayersModule(o, t, NbCardsInHand)); yield return(new FirstBettingRoundModule(o, t)); yield return(new CumulPotsModule(o, t)); //Flop yield return(new DealCardsToBoardModule(o, t, 3)); yield return(new BettingRoundModule(o, t)); yield return(new CumulPotsModule(o, t)); //Turn yield return(new DealCardsToBoardModule(o, t, 1)); yield return(new BettingRoundModule(o, t)); yield return(new CumulPotsModule(o, t)); //River yield return(new DealCardsToBoardModule(o, t, 1)); yield return(new BettingRoundModule(o, t)); yield return(new CumulPotsModule(o, t)); }
public PanelController(PokerTable pokerTable, IDatabase database) { this.database = database; this.PlayerPanels = this.Database.PlayerPanels; this.pokerTable = pokerTable; this.SetPanels(this.PokerTable); }
private void StartPokerGame(object gameTable) { PokerTable table = (PokerTable)gameTable; PokerGame game = _provider.GetService <PokerGame>(); game.Run(table.Id); // blocks until the game is complete }
public async Task <PokerTable> AddTable(PokerTable table) { var result = await _appDbContext.PokerTables.AddAsync(table); await _appDbContext.SaveChangesAsync(); return(result.Entity); }
public ChipsController(PokerTable pokerTable, IDatabase database) { this.database = database; this.pokerTable = pokerTable; this.Chips = this.Database.Chips; this.Locations = new Point[MaxPlayers + 1]; this.SetChips(this.PokerTable); }
public CardController(PokerTable pokerTable, IDatabase database) { this.database = database; this.pokerTable = pokerTable; this.ShuffledDeck = this.Database.ShuffledDeck; this.CardImages = this.Database.CardImages; this.Locations = new Point[(MaxPlayers * 2) + 5]; }
public UpdatesController(PokerTable pokerTable) { this.pokerTable = pokerTable; this.Updates = new Timer(); this.UpdateTickCount = MaxUpdateCountValue; this.Updates.Interval = 100; this.Updates.Tick += this.PokerTable.Update_Tick; }
public GameHandler(ICardController cardController, IDatabase database, PokerTable pokerTable) { this.database = database; this.cardController = cardController; this.dealHandler = new DealHandler(this.Database); this.betHandler = new BetHandler(this.Database); this.pokerTable = pokerTable; this.timerController = new TimerController(this.Database.Players[0]); }
public Engine(PokerTable pokerTable, IDatabase database) { this.pokerTable = pokerTable; this.database = database; this.cardController = new CardController(this.PokerTable, this.Database); this.chipsController = new ChipsController(this.PokerTable, this.Database); this.panelController = new PanelController(this.PokerTable, this.Database); this.GameHandler = null; }
public void SetUp() { _pokerTable = new PokerTable(); _dealer = _pokerTable.Dealer; _player1 = new Player("Player1"); _pokerTable.AddPlayer(_player1); _player2 = new Player("Player2"); _pokerTable.AddPlayer(_player2); }
public void SetUp() { _dealer = new Dealer(); _pokerTable = new PokerTable(_dealer, new TexasHoldemEngine()); _player1 = new Player("Player1"); _pokerTable.AddPlayer(_player1); _player2 = new Player("Player2"); _pokerTable.AddPlayer(_player2); }
/// <summary> /// Sets a specific player panel in a location on the table. /// </summary> /// <param name="pokerTable">The table.</param> /// <param name="playerPanel">The instance of the panel.</param> /// <param name="location">The location for the panel to be placed </param> /// <param name="index">Internal index for accessing each player's panel.</param> private void SetPlayerPanel(PokerTable pokerTable, Panel playerPanel, Point location, int index) { pokerTable.Controls.Add(playerPanel); playerPanel.Location = location; playerPanel.BackColor = Color.DarkBlue; playerPanel.Height = DefaultPanelHeight; playerPanel.Width = DefaultPanelWidth; playerPanel.Visible = false; playerPanel.Name = "pictureboxChip" + index.ToString(); }
public void PokerTable_has_a_list_of_players_when_initialized_with_an_empty_list() { // Arrange var target = new PokerTable(); // Act target.Initialize(new List <PokerHand>()); // Assert Assert.IsNotNull(target.Hands); }
public static void UpdateTable(PokerTable updatedPokerTable) { PokerTableDB pokerTableDB = new PokerTableDB(); PokerTable pokerTable = pokerTableDB.GetTableById(updatedPokerTable.Id); if (pokerTable == null) { throw new Exception("Table doesn't exist"); } pokerTableDB.Update(updatedPokerTable); }
private void TableHistoryList_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { currTable = (PokerTable)TableHistoryList.SelectedItems[0]; Replay_Btn.IsEnabled = true; } catch { TableHistoryList.UnselectAll(); } }
public IActionResult Create([FromBody] PokerTable item) { if (item == null) { return(BadRequest()); } _context.PokerTables.Add(item); _context.SaveChanges(); return(CreatedAtRoute("GetPokerTable", new { id = item.Id }, item)); }
public override IEnumerable<IGameModule> GetModules(PokerGameObserver o, PokerTable t) { yield return new DealMissingCardsToPlayersModule(o, t, NbCardsInHand); yield return new FirstBettingRoundModule(o, t); yield return new CumulPotsModule(o, t); yield return new DiscardRoundModule(o, t, 0, 5); yield return new DealMissingCardsToPlayersModule(o, t, NbCardsInHand); yield return new BettingRoundModule(o, t); yield return new CumulPotsModule(o, t); }
public Game() { this.availableCardsInGame = new int[17]; this.cardsImageDeck = new Image[52]; this.cardsHolder = new PictureBox[52]; this.timer = new Timer(); this.updates = new Timer(); this.ints = new List<int>(); this.inactivePlayers = new List<bool?>(); this.dataBase.Players[0] = this.humanPlayer; this.dataBase.Players[1] = this.firstBot; this.dataBase.Players[2] = this.secondBot; this.dataBase.Players[3] = this.thirdBot; this.dataBase.Players[4] = this.fourthBot; this.dataBase.Players[5] = this.fifthBot; this.table = new PokerTable(); this.dataBase.Table = this.table; this.call = this.defaultBigBlind; this.MaximizeBox = false; this.MinimizeBox = false; this.updates.Start(); this.InitializeComponent(); this.width = this.Width; this.height = this.Height; this.Shuffle(); this.textBoxPot.Enabled = false; this.textBoxChips.Enabled = false; this.textBoxBotChips1.Enabled = false; this.textBoxBotChips2.Enabled = false; this.textBoxBotChips3.Enabled = false; this.textBoxBotChips4.Enabled = false; this.textBoxBotChips5.Enabled = false; this.textBoxChips.Text = "chips : " + this.humanPlayer.Chips; this.textBoxBotChips1.Text = "chips : " + this.firstBot.Chips; this.textBoxBotChips2.Text = "chips : " + this.secondBot.Chips; this.textBoxBotChips3.Text = "chips : " + this.thirdBot.Chips; this.textBoxBotChips4.Text = "chips : " + this.fourthBot.Chips; this.textBoxBotChips5.Text = "chips : " + this.fifthBot.Chips; this.timer.Interval = 1 * 1 * 1000; this.timer.Tick += this.Timer_Tick; this.updates.Interval = 1 * 1 * 100; this.updates.Tick += this.Update_Tick; this.textBoxBigBlind.Visible = false; this.textBoxSmallBlind.Visible = false; this.buttonBigBlind.Visible = false; this.buttonSmallBlind.Visible = false; this.textBoxRaise.Text = (this.defaultBigBlind * 2).ToString(); }
/// <summary> /// Void method that places a card in a specific position on the table. /// </summary> /// <param name="pokerTable">Refers to the table </param> /// <param name="card">The card taken from the card database.</param> /// <param name="location">Location of the visualisation of the card.</param> /// <param name="index">Internal numbering for accessing the card.</param> private void SetCard(PokerTable pokerTable, PictureBox card, Point location, int index) { pokerTable.Controls.Add(card); card.Location = location; card.Height = DefaultCardHeight; card.Width = DefaultCardWidth; card.SizeMode = PictureBoxSizeMode.StretchImage; card.Name = "pictureboxCard" + index.ToString(); card.Visible = false; card.Tag = index; card.Anchor = AnchorStyles.Bottom; card.Visible = false; card.Image = null; }
public async Task <PokerTable> UpdateTable(PokerTable table) { var result = await _appDbContext.PokerTables.FirstOrDefaultAsync(e => e.Id == table.Id); if (result == null) { return(null); } result.MaxPlayers = table.MaxPlayers; result.Name = table.Name; return(result); }
public void PokerTable_determines_that_White_wins_with_highest_card() { // Arrange var target = new PokerTable(); var pokerhandlist = GetTestHand_WhiteWins(); // Act target.Initialize(pokerhandlist); var actual = target.Play(); //assert Assert.AreEqual(PokerPlayer.Black, actual.Name); }
public ServerResponse <PokerTableBL> GetTableByHistory(PokerTable replayTable) { ServerResponse <PokerTableBL> serverResponse = new ServerResponse <PokerTableBL>(); try { serverResponse.Result = serviceHandler.GetTableByHistory(replayTable); } catch (Exception e) { serverResponse.ErrorMsg = e.Message; } return(serverResponse); }
public void PokerTable_determines_that_hand_wins_with_One_Pair() { // Arrange var target = new PokerTable(); var pokerhandlist = GetTestHand_WhiteWinsOnePair(); // Act target.Initialize(pokerhandlist); var actual = target.Play(); //assert Assert.AreEqual(HandType.OnePair, actual.WinsBy); }
public static int InsertTable(PokerTable newPokerTable) { PokerTableDB pokerTableDB = new PokerTableDB(); PokerTable pokerTable = pokerTableDB.GetTableById(newPokerTable.Id); if (pokerTable == null) { pokerTableDB.IdentityInsert(newPokerTable); } else { UpdateTable(newPokerTable); } return(newPokerTable.Id); }
public RoomWindow(Room room) { this.room = room; InitializeComponent(); userPanel = new UserPanel(); this.topMainPanel.Content = userPanel; this.InfoText.Content = room; PokerTable.room = room; PokerTable.UpdateChairs(); this.gameLog = new ObservableCollection <string>(); GameLog.DataContext = gameLog; Chat.DataContext = room.Chat.GetMessages(); Service.Instance.AddPlayerToRoom(room.Id + "", MainInfo.Instance.Player.Username); MsgBox.KeyDown += new KeyEventHandler(MsgBox_KeyDown); }
/// <summary> /// Places chips for each player on the table at a specific place. /// </summary> /// <param name="pokerTable"></param> /// <param name="chip">Picture box holding the current amount of chips.</param> /// <param name="location">Coordinates of the picture box.</param> /// <param name="index">Internal index for accessing the chips on the table.</param> private void SetChip(PokerTable pokerTable, PictureBox chip, Point location, int index) { pokerTable.Controls.Add(chip); chip.Location = location; chip.Height = DefaultChipsHeight; chip.Width = DefaultChipsWidth; chip.SizeMode = PictureBoxSizeMode.StretchImage; chip.Name = "pictureboxChip" + index.ToString(); chip.Visible = false; chip.Tag = index; chip.Anchor = AnchorStyles.Bottom; chip.BackColor = Color.Transparent; chip.Visible = false; chip.Image = null; }
public void PokerTable_throws_exception_when_less_than_two_hands() { // Arrange var target = new PokerTable(); var pokerhandlist = new List <PokerHand>() { new PokerHand() { Name = PokerPlayer.White } }; // Act target.Initialize(pokerhandlist); }
/* * # 流程 * 1.桌控制器生成桌面牌数据,UI根据该数据生成卡牌到桌面(Done) * 2.桌控制器将tableCards发给三个玩家,添加到三个玩家的手牌数据List中,UI完成发牌的动画 * 3.需要排序手牌(桌控制器)然后显示手牌(UI) * 4.叫地主(玩家只能通过桌控制器提供的特定的接口来叫地主,桌控制器记录叫地主信息,之后决定谁是地主还是重新开) * 5.叫地主完成,将地主牌数据添加到地主,UI更新卡牌动画 * 6.开始出牌,地主先出(必须出,如果玩家在规定时间内没选择,系统默认出第一张),选择要出的牌的数据,提交控桌控制器验证,通过,添加数据到桌面,UI更新动画 * 7.玩家不出牌或提交卡牌数据未通过,时间结束或点击不出牌,桌控制器让下一个玩家出牌 * 8.电脑玩家出牌由桌控制器的AI自动出牌,不需要要二次验证 * 9.玩家出牌时提交出牌数据到桌控制器,控制器验证 * 10.每完成一次出牌,桌控制器验证该玩家是否胜利,如胜利,向MainCavas控制器请求打开胜利界面 * 11.用户选择重新开始或退出 * * # 说明 * 1.桌控制器和玩家只有CardInfo数据List,UI中使用一个List<Card>用来对应卡牌数据的更新 * 2.所有的卡牌移动、添加图片、提示信息的显示、玩家操作选项显示都是在桌控制器中控制,控制器调用UI中相应模块完成显示 * 3.玩家和电脑、地主和出牌都只能向桌控制器发送相应的请求,桌控制器得到请求信息后控制叫地主、出牌的控制 * 4.电脑AI出牌部分放在了桌控制器中,桌控制器也相当于电脑AI,这样可以不需要进行二次桌验证 * 5.对于PlayeInfo类,应该是在网络版斗地主中保存玩家的个人信息,而BasePlayer类保存的是当前桌面上该玩家游戏的数据(如玩家手牌,在离开该局游戏后就销毁了) */ /// <summary> /// 构造函数 /// </summary> public PokerTableControl() { pokerTable = new PokerTable(); //随机玩家索引 startIndex = MyUtil.GetRange(0, 3); playerIndex = startIndex; //实例化三个玩家 players.Add(new Player()); players.Add(new PlayerComputer1()); players.Add(new PlayerComputer2()); //代理事件添加 AddAction(); }
public void SetChips(PokerTable pokerTable) { this.Chips = new PictureBox[MaxPlayers + 1]; for (int i = 0; i < this.Locations.Length; i++) { this.Locations[i] = new Point(0, 0); } this.SetLocations(); for (int i = 0; i < MaxPlayers + 1; i++) { this.Chips[i] = new PictureBox(); this.SetChip(pokerTable, this.Chips[i], this.Locations[i], i); } }
public void SetCards(PokerTable pokerTable) { this.ShuffledDeck = new PictureBox[(MaxPlayers * 2) + 5]; for (int i = 0; i < this.Locations.Length; i++) { this.Locations[i] = new Point(0, 0); } this.SetLocations(); for (int i = 0; i < (MaxPlayers * 2) + 5; i++) { this.ShuffledDeck[i] = new PictureBox(); this.SetCard(pokerTable, this.ShuffledDeck[i], this.Locations[i], i); } }
public WaitForPlayerModule(PokerGameObserver o, PokerTable table) : base(o, table) { }
public CumulPotsModule(PokerGameObserver o, PokerTable table) : base(o, table) { }
public FirstBettingRoundModule(PokerGameObserver o, PokerTable table) : base(o, table) { }
public DealMissingCardsToPlayersModule(PokerGameObserver o, PokerTable table, int nbCardsFaceDown, int nbCardsFaceUp = 0) : base(o, table) { NbCardsFaceDown = nbCardsFaceDown; NbCardsFaceUp = nbCardsFaceUp; }
public EndGameModule(PokerGameObserver o, PokerTable table) : base(o, table) { }
public ShowDownModule(PokerGameObserver o, PokerTable table) : base(o, table) { }
public WaitForBlindsModule(PokerGameObserver o, PokerTable table) : base(o, table) { }
public abstract IEnumerable<IGameModule> GetModules(PokerGameObserver o, PokerTable table);
public DiscardRoundModule(PokerGameObserver o, PokerTable table, int minimum, int maximum) : base(o, table) { m_Minimum = minimum; m_Maximum = maximum; }
public DistributeMoneyModule(PokerGameObserver o, PokerTable table) : base(o, table) { }
protected AbstractGameModule(PokerGameObserver o, PokerTable table) { Observer = o; Table = table; }
public DealCardsToBoardModule(PokerGameObserver o, PokerTable table, int nbCards) : base(o, table) { NbCards = nbCards; }
public DecideWinnersModule(PokerGameObserver o, PokerTable table) : base(o, table) { }