public BingoCard1(BingoCardState card, int x, int y, int width, int height) { InitializeComponent(); Location = new Point(x, y); Size = new Size(width, height); _Card = card; }
public void Add(BingoCardState card) { Controls.Add(new BingoCard1(card, new_block_x, new_block_y, default_size, default_size)); new_block_x += default_size + default_pad; if (new_block_x > (Width - (default_size + assumed_scrollbar_size))) { new_block_x = 0; new_block_y += default_size + default_pad; } }
static Brush win_best_pattern_daub = Brushes.GreenYellow; // marked winning pattern void DrawSingleCard(Graphics g, BingoCardState _Card, PlayerPack pack, int game, int offset, int card_row, int card_col) { byte[, ,] data = _Card.CardData; int row, col; int best_pattern_mask = _Card.BestMask(pack.state[game].combination[offset]); int card_mask = _Card.MarkMask(pack.state[game].combination[offset]); bool win = false; int lastball = _Card.Lastball; g.Transform.Reset(); g.ScaleTransform(1, 1); if (_Card.BestAway() == 0) { win = true; } /* * if( _Card.BestAway == 25 ) * { * g.FillRectangle( blank, new Rectangle( 0, 0, Width, Height ) ); * g.DrawString( "No", Font, new SolidBrush( this.ForeColor ), new PointF( 2, 2 ) ); * g.DrawString( "Play", Font, new SolidBrush( this.ForeColor ), new PointF( 2, 2 + (Height/5) ) ); * } * else */ { int rows = _Card.CardData.GetLength(2); int cols = _Card.CardData.GetLength(1); int xx = (Width - (pack.pack_info.cols * card_gap)) / (pack.pack_info.cols * cols); int yy = (Height - (pack.pack_info.cols * card_gap)) / (pack.pack_info.rows * rows); for (row = 0; row < rows; row++) { for (col = 0; col < cols; col++) { int bit = 1 << col * rows + row; Brush color = blank; if ((card_mask & best_pattern_mask & (bit)) != 0) { ///***** SHOULD FIX THIS if (data[0, col, row] == lastball) { if (win) { color = win_last; } else { color = last; } } else { // marked, and in pattern. if (win) { color = win_best_pattern_daub; } else { color = best_pattern_daub; } } } else if ((best_pattern_mask & (bit)) != 0) { if (win) { color = win_best_pattern; } else { color = best_pattern; } // not marked, and in pattern } else if ((card_mask & (bit)) != 0) { if (win) { color = win_daubed; } else { color = daubed; } } g.FillRectangle(color, new Rectangle(card_col * (cols * xx) + col * xx + card_col * card_gap , card_row * (rows * yy) + row * yy + card_row * card_gap , xx, yy)); Color text = _Card.pack.paper ? Color.DarkBlue : Color.DarkGreen; g.DrawString(data[0, col, row].ToString() , Font , new SolidBrush(text) , new PointF(card_col * (cols * xx) + col * xx + card_col * card_gap , card_row * (rows * yy) + row * yy + card_row * card_gap)); } } } }
void DrawDoubleCard(Graphics g, BingoCardState _Card) { byte[, ,] data = _Card.CardData; int row, col; int best_pattern_mask = _Card.BestMask(); int card_mask = _Card.MarkMask(); bool win = false; int lastball = _Card.Lastball; g.Transform.Reset(); g.ScaleTransform(1, 1); if (_Card.BestAway() == 1) { win = true; } /* * if( _Card.BestAway == 25 ) * { * g.FillRectangle( blank, new Rectangle( 0, 0, Width, Height ) ); * g.DrawString( "No", Font, new SolidBrush( this.ForeColor ), new PointF( 2, 2 ) ); * g.DrawString( "Play", Font, new SolidBrush( this.ForeColor ), new PointF( 2, 2 + (Height/5) ) ); * } * else */ { int rows = _Card.CardData.GetLength(2); int cols = _Card.CardData.GetLength(1); for (row = 0; row < rows; row++) { for (col = 0; col < cols; col++) { int bit = 1 << row * cols + col; Brush color = blank; if ((card_mask & best_pattern_mask & (bit)) != 0) { for (int face = 0; face < 2; face++) { ///***** SHOULD FIX THIS if (data[face, col, row] == lastball) { if (win) { color = win_last; } else { color = last; } } else { // marked, and in pattern. if (win) { color = win_best_pattern_daub; } else { color = best_pattern_daub; } } } } else if ((best_pattern_mask & (bit)) != 0) { if (win) { color = win_best_pattern; } else { color = best_pattern; } // not marked, and in pattern } else if ((card_mask & (bit)) != 0) { if (win) { color = win_daubed; } else { color = daubed; } } int xx = Width / cols; int fx = xx / data.GetLength(0); int yy = Height / rows; g.FillRectangle(color, new Rectangle(col * xx, row * yy, xx, yy)); Color text = _Card.pack.paper ? Color.DarkBlue : Color.DarkGreen; for (int face = 0; face < 2; face++) { g.DrawString(data[face, col, row].ToString() , Font , new SolidBrush(text) , new PointF((col * xx) + (face * fx), row * yy)); } } } } }
/// <summary> /// Add to the counts in game.stats. /// Check for the five last ball calls coming from the B, I, N, G, O columns. /// Check for the bingo pattern matching the same color code from the random color table. /// </summary> /// <param name="s"> bingo_odds.OddsRunInfo.state value</param> void CountStats(state s) { GameInfo game = s.game as GameInfo; int winners = s.winning_cards.Count; for (int cn = 0; cn < s.playing_cards.Count; cn++) { BingoCardState card = s.playing_cards[cn]; if (card.marks.Count != 0) { BingoCardState.BingoCardPatternMarkInfo cs = card.marks[card.marks.Count - 1]; if (cs.best_away < 5 && cs.best_away > 0) { game.stats.aways[cs.best_away - 1]++; } } } game.stats.wins += winners; game.stats.best_wins[s.bestwin] += winners; game.stats.plays++; if (s.game_event.playing_balls != null && s.game_event.playing_balls.Length > 0) { int lastball = s.game_event.playing_balls[s.game_event.playing_balls.Length - 1] - 1; if (lastball >= 0) { game.stats.lastBalls[lastball] += 1; } } wins[s.bestwin] += winners; bestwins[s.bestwin] += s.bestwincount; TotalWins += winners; TotalCards += s.Cards; TotalCount += winners; if (colored_balls > 0) { int[] ball_array = s.game_event.playing_balls; int balls = ball_array.Length; int n; int step = 0; for (n = 0; n < balls; n++) { if (ball_array[n] < 0) { game.stats.colored_ball_hit[step++]++; } } if (balls > 2) { if (ball_array[balls - 2] < 0) { game.stats.colored_ball_before_win++; } } } if (flags.Count_BINGO_Calls) { // If we're ignoring a column, we won't match on // the last five calls containing the BINGO letters. if (!s.game.ignore_b_balls && !s.game.ignore_i_balls && !s.game.ignore_n_balls && !s.game.ignore_g_balls && !s.game.ignore_o_balls) { int[] ball_array = s.game_event.playing_balls; int balls = ball_array.Length; int counter; int bits = 0; int ordered_bits = 0; for (counter = balls - 1; counter > (balls - 6) && counter >= 0; counter--) { int bit = (1 << ((ball_array[counter] - 1) / 15)); switch (bit) { case 1: if (ordered_bits == 0x1E) { ordered_bits |= bit; } break; case 2: if (ordered_bits == 0x01C) { ordered_bits |= bit; } break; case 4: if (ordered_bits == 0x018) { ordered_bits |= bit; } break; case 8: if (ordered_bits == 0x010) { ordered_bits |= bit; } break; case 16: if (ordered_bits == 0) { ordered_bits |= bit; } break; } bits |= bit; } if (ordered_bits == 0x1f) { game.stats.BINGO_Call_Wins_ordered++; } if (bits == 0x1F) { game.stats.BINGO_Call_Wins++; } } } if (flags.countColorBINGO) { // CHECK FOR SAME COLOR BINGO USING RANDOM COLOR GENERATOR int color_count = CountRandomColorBingo(s); if (color_count > 0) { game.stats.BINGO_Same_Color += color_count; } } }
public BingoCardStateControl(BingoCardState card) { }