示例#1
0
        private void btnGivemeCard_Click(object sender, RoutedEventArgs e)
        {
            BingoService bs = new BingoService(75);

            txtCard.Text = "";
            PositionCardboard[,] cardboard = bs.DealCardboard();

            bool win   = bs.ValidateGame(cardboard, Modes.Corner);
            int  count = 0;

            while (!win && count < 75)
            {
                System.Threading.Thread.Sleep(50);
                Position p = bs.CallPosition();
                bs.ValidateCardboard(p, cardboard);
                for (int i = 0; i < 5; i++)
                {
                    for (int j = 0; j < 5; j++)
                    {
                        if (cardboard[j, i].Marked)
                        {
                            Console.BackgroundColor = ConsoleColor.Red;
                            Console.ForegroundColor = ConsoleColor.White;
                            Console.Write(cardboard[j, i]);
                            Console.ResetColor();
                        }
                        else
                        {
                            Console.Write(cardboard[j, i]);
                        }
                    }
                }
                win = bs.ValidateGame(cardboard, Modes.Corner);
                count++;
            }
            if (win)
            {
                txtStatus.Text = "You Win!!!";
            }
            else
            {
                txtStatus.Text = "Loser";
            }
        }
示例#2
0
 public bool ValidatePlayerGame(List <PositionCardboard[, ]> cardboards, int[,] mode)
 {
     foreach (PositionCardboard[,] cardboard in cardboards)
     {
         if (BingoService.ValidateGame(cardboard, mode))
         {
             return(true);
         }
         System.Threading.Thread.Sleep(20);
     }
     return(false);
 }