Ejemplo n.º 1
0
        public void RandomNumberGenerator(object sender, ElapsedEventArgs e)
        {
            if (CurrentGuessesNumbersNumber == GuessNumber)
            {
                if (WinnerNumberHistory[GuessNumber - 1] == 0)
                {
                    Random random = new Random();
                    Int32  theCurrentWinnerNumber = random.Next(1, MapSizeX * MapSizeY);
                    while (WinnerNumberHistory.Contains(theCurrentWinnerNumber))
                    {
                        theCurrentWinnerNumber = random.Next(1, MapSizeX * MapSizeY);
                    }

                    WinnerNumberHistory[CurrentWinnerNumbersNumber] = theCurrentWinnerNumber;
                    CurrentWinnerNumbersNumber++;


                    Boolean b = false;
                    if (GuessesNumberHistory.Contains(theCurrentWinnerNumber))
                    {
                        b = true;
                        Score++;
                    }
                    RandomWinnerNumber(this, new RandomEventArgs(theCurrentWinnerNumber, b));
                }
            }
        }
Ejemplo n.º 2
0
 public void Step(Int32 x, Int32 y, Int32 ind)
 {
     if (GuessesNumberHistory[GuessNumber - 1] == 0 && !GuessesNumberHistory.Contains(ind))
     {
         GuessesNumberHistory[CurrentGuessesNumbersNumber] = ind;
         CurrentGuessesNumbersNumber++;
         GuessAction(this, new LottoEventArgs(x, y));
     }
 }