Ejemplo n.º 1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {

            btnOption1.Content = ans;
            int answer = Convert.ToInt32(btnOption1.Content); //gets actual answer from button

            if (answer == ans) //checks if answer from button is the calculated answer
            {
                MessageBox.Show("Correct!");
                txtQuestionSpace.Clear();
                timer.Stop();
                Siya.Clear();
               
            }
        }
Ejemplo n.º 2
0
 public static void TurretUpdate(int h, double x, double y, Turtle Tur)
 {
     Tur.BrushDown = false;
     Tur.Goto(x, y); //Replace With Tank coord
     Tur.Clear();
     Tur.Heading   = h;
     Tur.BrushDown = true;
     Tur.Forward(10);
 }
Ejemplo n.º 3
0
 private void Strike(int num = 0)   //Displays who won and ends the current game session
 {
     game = new int[3, 3];          //clears the current array of game so that its state is that of a new game
     computer_AI.IsEnabled = false; //stops the event handler so that ther computer doesnt keep trying tofigure out where to play as the game is over this makes it so there isnt an infinite loop
     running = false;               //makes it so the player cannot play as it isn't the players turn
     if (num == 2)                  //2 represents the players number in the array so if the last shape to be played is 2 the player wins
     {
         MessageBox.Show("You win");
         win.Content = Convert.ToString(++Human_score);
     }
     else if (num == 1)//1 repesents the computers number
     {
         MessageBox.Show("Computer wins");
         lose.Content = Convert.ToString(++AI_score);
     }
     else// number 0 indicates a draw meaning that neither player nor the computer has won
     {
         MessageBox.Show("Draw");
         drawz.Content = Convert.ToString(++Draw_score);
     }
     Draw.Clear();
     play.Children.Clear();
     BeginGame();
 }
Ejemplo n.º 4
0
 private void doSomeStamping()
 {
     tess.Clear();
     tess.WarpTo(300, 300);
     for (int i = 0; i < 8; i++)
     {
         tess.Stamp();
         tess.Forward(150);
         tess.Left(45);
         // change the brush colour to test that things don't go awry.
         if (i == 4)
         {
             tess.LineBrush = Brushes.Navy;
         }
     }
 }
Ejemplo n.º 5
0
        private void showTime()
        {
            DateTime curr = DateTime.Now;               // Get the computer's time

            txtResult.Text = curr.ToLongTimeString();   // Show it in the textbox

            tess.Clear();
            tess.WarpTo(200, 200);

            // Get the hours, mins and secs we want to represent on the clock face.
            double hours = curr.TimeOfDay.TotalHours;
            double mins  = curr.TimeOfDay.TotalMinutes;
            double secs  = curr.TimeOfDay.TotalSeconds;

            drawHand(tess, hours * 30, 80, 5, Brushes.Red);
            drawHand(tess, mins * 6, 110, 3, Brushes.Yellow);
            drawHand(tess, secs * 6, 140, 1, Brushes.Blue);
        }
Ejemplo n.º 6
0
        private void drawNextTree()
        {
            tess.BatchSize = 0;
            tess.Clear();

            tess.WarpTo(playground.ActualWidth / 2, playground.ActualHeight - 10);
            tess.Heading = -90;

            drawTree(7, theta, playground.ActualHeight - 10);

            theta += 2;
            tess.FlushToPlayground();

            if (++frameCounter % 20 == 0)
            {
                TimeSpan ts   = DateTime.Now.Subtract(t0);
                double   rate = frameCounter / ts.TotalSeconds;
                frameCounter = 0;
                //   this.Title = String.Format("Frame rate = {0}", rate);
                t0 = DateTime.Now;
            }
        }
Ejemplo n.º 7
0
        private void btnGO_Click(object sender, RoutedEventArgs e)
        {
            tess.Clear();
            tess.WarpTo(200, 200);
            tess.BrushDown      = false;
            tess.BrushWidth     = 4;
            tess.DelayMillisecs = 100;

            int h = 0;

            while (h < 12)
            {
                tess.Forward(90);
                tess.BrushDown = true;
                tess.Forward(10);
                tess.BrushDown = false;
                tess.Forward(20);
                tess.Stamp();
                tess.Forward(-120);
                tess.Right(360 / 12);
                h = h + 1;
            }
        }
Ejemplo n.º 8
0
 private void butClearTess_Click(object sender, RoutedEventArgs e)
 {
     tess.Clear();
 }
Ejemplo n.º 9
0
 void Clear()
 {
     tess.Clear();
     tess.WarpTo(0, 200);
 }
Ejemplo n.º 10
0
 /*  opdracht 6: */
 private void button7_Click(object sender, RoutedEventArgs e)
 {
     tess.Clear();
     alex.Clear();
 }