void listBox1_SelectedIndexChanged(object sender, EventArgs e) { BingoPlayer tmp_player = listBox1.SelectedItem as BingoPlayer; if (tmp_player != null) { if (player != tmp_player) { player = tmp_player; current_card = 0; bingoCardGroup1.Clear(); foreach (BingoCardState card in player._played_cards[state.game.game_ID]) { bingoCardGroup1.Add(card); } /* * bingoPackGroup1.Clear(); * foreach( PlayerPack pack in player.played_packs ) * { * // was not matched as a pack. * if( pack.state == null ) * continue; * if( pack.Cards.Count > current_game ) * if( pack.Cards[current_game].Count > 0 ) * bingoPackGroup1.Add( pack, current_game ); * } */ UpdateCard(); } } }
void InitPlayer() { if (session_event._PlayerList.Count > 0) { player = session_event._PlayerList[0]; current_game = 0; current_card = 0; state = session_event.BingoGameEvents[current_game]; } }
private void button6_Click(object sender, EventArgs e) { try { session = new BingoSession(schedule, DateTime.Now, 1); } catch { return; } session_event = new BingoSessionEvent(session, true); session_event.Open(); int n; BingoPack[] play_packs = SelectPacks.Show(session_event); for (n = 0; n < 150; n++) { BingoPlayer player; session_event.PlayerList.Add(player = new BingoPlayer(n.ToString("0:00000"))); PlayerTransaction transaction; player.transactions.Add(transaction = new PlayerTransaction(player, n)); PlayerPack[] packs = new PlayerPack[play_packs.Length]; int z = 0; foreach (BingoPack pack in play_packs) { packs[z++] = session_event.session.GameList.pack_list.GetPlayerPacks(pack.name, "Pos 1")[0]; } if (packs != null) { foreach (PlayerPack pack in packs) { pack.player = player; pack.unit_number = 1001 + n; transaction.Add(pack); player.played_packs.Add(pack); } } else { MessageBox.Show("Probably need to edit the schedule to assign new pack to a game group"); } } // commit all players, their transactions and packs to the game event database. session_event.StorePlayers(); listBox1.Items.Add("Loaded " + session_event.PlayerList.Count + " Player" + ((session_event.PlayerList.Count == 1) ? "" : "s")); }
void dataGridViewPlayers_SelectionChanged(object sender, EventArgs e) { DataGridViewSelectedCellCollection cells = dataGridViewPlayers.SelectedCells; foreach (DataGridViewCell cell in cells) { if (cell.ColumnIndex == 0 && cell.Value != null) { BingoPlayer player = cell.Value as BingoPlayer; listBoxPacks.DataSource = player.played_packs; } } }
private void button3_Click(object sender, EventArgs e) { // play cards vs db... BingoSession session = new BingoSession(); Pattern p = new Pattern(); p.algorithm = OpenSkieScheduler3.PatternDescriptionTable.match_types.CrazyMark; p.repeat_count = 24; p.crazy_hardway = true; BingoGame game; session.GameList.Add(game = new BingoGame(new BingoGameCore4.Pattern[] { p })); BingoGameGroup game_group = new BingoGameGroup(Guid.Empty); game_group.Add(game); BingoPacks packs = new BingoPacks(session.GameList, schedule, null); BingoGameCore4.CardMaster.CardReader card_file = new BingoGameCore4.CardMaster.CardReader("c:\\ftn3000\\data\\cards\\Random 360k (50s300w)(81_Full).20110225.dat"); BingoDealer dealer = BingoDealers.GetDealer(card_file, 1, 1); packs.CreatePack(dealer, "Test Pack"); BingoPack pack = packs.MakePack("Test Pack", card_file.Length); BingoSessionEvent session_evnet = new BingoSessionEvent(session, true); BingoPlayer player; player = new BingoPlayer(); PlayerTransaction transaction; player.transactions.Add(transaction = new PlayerTransaction(player, 12345689)); player.PlayPack(transaction, pack); session_evnet.PlayerList.Add(player); BallDataExternal bde = new BallDataExternal(); session_evnet.ball_data = bde; BingoGameState game_state = session_evnet.StepTo(0); bde.Balls = calls[0]; session_evnet.Play(game_state); }
void PurchasePacks() { for (int playr = 0; playr < 50; playr++) { PlayerTransaction transaction; BingoPlayer player; player = new BingoPlayer(); transaction = new PlayerTransaction(player, playr); player.transactions.Add(transaction); foreach (DataRow row in pack_play_table.Rows) { int numplay = Convert.ToInt32(row["Avg"]); int percent_avg = Convert.ToInt32(row["percent average"]); if (OverPercent(percent_avg)) { // not average if (OverPercent(Convert.ToInt32(row["percent above average"]))) { numplay = numplay - (entropy.Next(numplay - Convert.ToInt32(row["min"])) + 1); } else { // above average (less than or equal to 75% for instance) numplay = numplay + (entropy.Next(Convert.ToInt32(row["max"]) - numplay) + 1); } } if (numplay > 0) { BingoPack pack = session.GameList.pack_list[pack_play_table.Rows.IndexOf(row)]; for (int n = 0; n < numplay; n++) { player.PlayPack(transaction, pack); } } } session_event.PlayerList.Add(player); } session_event.StorePlayers(); }
//GameInfo prior_game = null; public state Step() { state result = new state(); //Log.log( "Begin Step" ); lock (this.step_lock) { // check to see if we're trying to end this. if (end) { // valid will already be false. return(result); } // check to see if the total duration is complete... if (_years == Years) { return(result); } { { _total_games++; _games++; if (_games >= Games) { // need to do a step of session. // setup some hotballs .... _total_sessions++; _sessions++; if (_sessions >= Sessions) { _halls++; if (_halls >= Halls) { _days++; if (_days >= Days) { _years++; if (_years >= Years) { return(result); // here, result is not stepped. } _days = 0; } _halls = 0; } _sessions = 0; } _games = 0; /// have counted the session, and now session is correct. /// // new session, create a new session event. session_event = new BingoSessionEvent(bingo_session, false); if (trigger_stats.enabled) { ball_data_interface.DropBalls(); session_event.trigger_balls = ball_data_interface.CallBalls(1); ball_data_interface.DropBalls(); session_event.triggered_balls = new int[trigger_stats.max_triggered]; session_event.triggered_ball_won = new bool[trigger_stats.max_triggered]; } session_event.SaveToDatabase = flags.database_run; session_event.Open(base_date.AddDays(_days), _sessions + 1); // We need to add _days to the session_event.bingoday // here so StateWriter (in BingoGameCore, which knows // nothing about the OddsRunInfo.state) will assign // the correct date to the records written to table // called_game_player_rank2. session_event.bingoday = session_event.bingoday.AddDays(_days); { BingoPlayers players = new BingoPlayers(); // create some players. for (int p = 0; p < Players; p++) { BingoPlayer player; players.Add(player = new BingoPlayer(Guid.NewGuid())); PlayerTransaction transaction; player.transactions.Add(transaction = new PlayerTransaction(player, p)); foreach (BingoGameGroup bgg in session_event.session.GameGroups) { foreach (BingoPack pack in bgg.packs) { // something like this... so we can sell so many packs for players // but now players are not just sets of cards. for (int n = 0; n < Cards / PackSize; n++) { PlayerPack played; player.played_packs.Add(played = new PlayerPack()); played.transaction = transaction; played.pack_info = pack; played.start_card = pack.AutoDeal(); played.pack_set = 1; played.player = player; played.pack_info.game_list = bingo_session.GameList; transaction.Add(played); } } } } session_event.PlayerList = players; } } /// have counted the games and the game is correct. session_event.StepToUsing(_games, (BingoGameState)result, ball_data_interface); // this is passed game index... session_event.LoadPlayerCards(result); result.Year = _years; result.Day = _days; result.Hall = _halls; result.Game = _games; // here we can keep going, it's counting... maybe // something like skipping a game for some reason causes invalidity... // which is not terminal. result.stepped = true; } } //Log.log( "Created session evnet and players in session" ); // return this state so we can unlock it. // with these balls and cards referenced // we should not have a problem with multi-threading this. return(result); } }
protected override void OnLoad(EventArgs e) { Control c; c = checkBox1; for (int col = 0; col < 5; col++) { for (int row = 0; row < 5; row++) { if (row == 0 && col == 0) { card[col, row] = c as CheckBox; continue; } CheckBox c2 = new CheckBox(); c2.Location = new Point(c.Location.X + 44 * col, c.Location.Y + 32 * row); c2.Size = c.Size; this.Controls.Add(c2); card[col, row] = c2; } } c = label1; board[0] = c; for (int col = 0; col < 15; col++) { for (int row = 0; row < 5; row++) { if (row == 0 && col == 0) { continue; } Control c2 = new Label(); c2.Location = new Point(c.Location.X + 25 * col, c.Location.Y + 18 * row); c2.Size = c.Size; c2.BackColor = Color.ForestGreen; this.Controls.Add(c2); board[row * 15 + col] = c2; } } c = label2; board2[0] = c; for (int col = 0; col < 15; col++) { for (int row = 0; row < 5; row++) { if (row == 0 && col == 0) { continue; } Control c2 = new Label(); c2.Location = new Point(c.Location.X + 25 * col, c.Location.Y + 18 * row); c2.Size = c.Size; c2.BackColor = Color.ForestGreen; this.Controls.Add(c2); board2[row * 15 + col] = c2; } } c = label3; board3[0] = c; for (int col = 0; col < 15; col++) { for (int row = 0; row < 5; row++) { if (row == 0 && col == 0) { continue; } Control c2 = new Label(); c2.Location = new Point(c.Location.X + 25 * col, c.Location.Y + 18 * row); c2.Size = c.Size; c2.BackColor = Color.ForestGreen; this.Controls.Add(c2); board3[row * 15 + col] = c2; } } //base.OnLoad( e ); if (session_event.PlayerList != null && session_event.PlayerList.Count > 0) { player = session_event.PlayerList[0]; } if (player != null) { UpdateCard(); bingoCardGroup1.Clear(); foreach (BingoCardState card in player._played_cards[current_game]) { bingoCardGroup1.Add(card); } //bingoPackGroup1.Clear(); /* * foreach( PlayerPack pack in player.played_packs ) * { * if( pack.Cards[current_game].Count > 0 ) * bingoPackGroup1.Add( pack, current_game ); * } */ } }
public void MyTestCleanup() { mockBingoEvaluator = null; mockBingoCard = null; target = null; }
public void MyTestInitialize() { mockBingoEvaluator = new Mock <IBingoEvaluator>(); mockBingoCard = new Mock <IBingoCard>(); target = new BingoPlayer(mockBingoEvaluator.Object, mockBingoCard.Object); }