Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace WpfApplication5
- {
- /// <summary>
- /// Interaction logic for MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- }
- private void Process(object sender, RoutedEventArgs e)
- {
- if ((string)(sender as Button).Content == "") { (sender as Button).Content = "X"; }
- else return;
- Random rnd = new Random();
- Button[] button = { LD, MD, RD , LM, MM, RM, LU, MU, RU};
- int random = 226;
- int G = 0;
- for (;;)
- {
- random = rnd.Next(9);
- if ((string)button[random].Content == "")
- {
- button[random].Content = "0";
- break;
- }
- else G++;
- if(G == 9) break;
- }
- if((string)LD.Content == "X" && (string)MD.Content == "X" && (string)RD.Content == "X") MessageBox.Show("Win");
- else if((string)LM.Content == "X" && (string)MM.Content == "X" && (string)RM.Content == "X") MessageBox.Show("Win");
- else if ((string)LU.Content == "X" && (string)MU.Content == "X" && (string)RU.Content == "X") MessageBox.Show("Win");
- else if ((string)LD.Content == "X" && (string)LM.Content == "X" && (string)LU.Content == "X") MessageBox.Show("Win");
- else if ((string)MD.Content == "X" && (string)MM.Content == "X" && (string)MU.Content == "X") MessageBox.Show("Win");
- else if ((string)RD.Content == "X" && (string)RM.Content == "X" && (string)RU.Content == "X") MessageBox.Show("Win");
- else if ((string)LU.Content == "X" && (string)MM.Content == "X" && (string)RD.Content == "X") MessageBox.Show("Win");
- else if ((string)RU.Content == "X" && (string)MM.Content == "X" && (string)LD.Content == "X") MessageBox.Show("Win");
- //
- //
- else if ((string)LD.Content == "0" && (string)MD.Content == "0" && (string)RD.Content == "0") MessageBox.Show("Lose");
- else if ((string)LM.Content == "0" && (string)MM.Content == "0" && (string)RM.Content == "0") MessageBox.Show("Lose");
- else if ((string)LU.Content == "0" && (string)MU.Content == "0" && (string)RU.Content == "0") MessageBox.Show("Lose");
- else if ((string)LD.Content == "0" && (string)LM.Content == "0" && (string)LU.Content == "0") MessageBox.Show("Lose");
- else if ((string)MD.Content == "0" && (string)MM.Content == "0" && (string)MU.Content == "0") MessageBox.Show("Lose");
- else if ((string)RD.Content == "0" && (string)RM.Content == "0" && (string)RU.Content == "0") MessageBox.Show("Lose");
- else if ((string)LU.Content == "0" && (string)MM.Content == "0" && (string)RD.Content == "0") MessageBox.Show("Lose");
- else if ((string)RU.Content == "0" && (string)MM.Content == "0" && (string)LD.Content == "0") MessageBox.Show("Lose");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement