Exemple #1
0
        private void EndRound()
        {
            int pscore = AwardPoints(PlayerResult);
            int cscore = 0;

            try
            {
                cscore = AwardPoints(ComputerResults.Item3);
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Computer failed to submit an answer in time");
            }

            if (pscore > cscore)
            {
                PlayerScore += pscore;
            }
            else if (pscore < cscore)
            {
                ComputerScore += cscore;
            }
            else
            {
                PlayerScore   += pscore;
                ComputerScore += cscore;
            }

            //MessageBox.Show("Wait");

            if (RoundNo < 2)
            {
                RoundNo++;
                this.Hide();
                NumberSelection ns = new NumberSelection();
                ns.Show();
            }
            else
            {
                GameOver g;

                if (PlayerScore > ComputerScore)
                {
                    g = new GameOver("player");
                }
                else if (PlayerScore < ComputerScore)
                {
                    g = new GameOver("computer");
                }
                else
                {
                    g = new GameOver("draw");
                }
                g.Show();
                this.Hide();
            }
        }
Exemple #2
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            NumberSelection ns = new NumberSelection();

            ns.Show();
            this.Hide();
            Form1.PlayerScore   = 0;
            Form1.ComputerScore = 0;
            Form1.RoundNo       = 1;
        }