Пример #1
0
        public MainWindow()
        {
            InitializeComponent();
            ticTac = new TicTac();

            this.newGame();
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            TicTac.player1 = textBox1.Text;
            TicTac.player2 = textBox2.Text;

            TicTac.FirstPlayer();

            if (textBox1.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("Input correct names!");
            }
            else if (TicTac.player1_id == 1)
            {
                //Message(TicTac.player1);
                is_multyp = true;
            }
            else if (TicTac.player2_id == 1)
            {
                //Message(TicTac.player2);
                is_multyp = true;
            }

            if (is_multyp)
            {
                TicTac.is_multyp = true;
                this.Close();
            }
        }
Пример #3
0
 public Form1()
 {
     MessageBox.Show("Dev. by FAFAFA");
     InitializeComponent();
     create_clicked(false);
     pack_id = TicTac.pack();
     create_grid(-1);
 }
        public void ConvertToArrayLocationTestLow()
        {
            TicTac t = new TicTac();
            int[] expected = new int[] { 0, 1 };

            int[] actual = t.ConvertToArrayLocation("2");

            CollectionAssert.AreEqual(expected, actual);
        }
        public void ConvertToArrayLocationTestOutOfBounds()
        {
            //What should happen when the user enters an invalid number (out of bounds of the map)?
            TicTac t = new TicTac();
            int[] expected = new int[] { 2, 2 };

            int[] actual = t.ConvertToArrayLocation("15");

            CollectionAssert.AreEqual(expected, actual);
        }
        public void ConvertToArrayLocationTestNonInt()
        {
            //This test is here to show you invalid input is not handled
            TicTac t = new TicTac();
            int[] expected = new int[] { 2, 2 };

            int[] actual = t.ConvertToArrayLocation("a");

            CollectionAssert.AreEqual(expected, actual);
        }
Пример #7
0
        public void ConvertToArrayLocationTestOutOfBounds()
        {
            //What should happen when the user enters an invalid number (out of bounds of the map)?
            TicTac t = new TicTac();
            int[] expected = new int[] { 2, 2 };

            try
            {
                int[] actual = t.ConvertToArrayLocation("15");
            }
            catch (IndexOutOfRangeException e)
            {
                Assert.IsInstanceOfType(e, typeof(IndexOutOfRangeException));
            }
        }
Пример #8
0
        public void ConvertToArrayLocationTestNonInt()
        {
            //This test is here to show you invalid input is not handled
            TicTac t = new TicTac();
            int[] expected = new int[] { 2, 2 };

            try
            {
                int[] actual = t.ConvertToArrayLocation("a");
            }
            catch (FormatException e)
            {
               Assert.IsInstanceOfType(e, typeof(FormatException));
            }
        }
Пример #9
0
        public void newmp()
        {
            Newgame();
            TicTac.is_multyp   = true;
            TicTac.iter        = 0;
            label1.Text        = null;
            pictureBox10.Image = null;
            label3.Text        = $"{TicTac.player1_score} : {TicTac.player2_score}";
            label1.ForeColor   = Color.Black;
            label2.ForeColor   = Color.Black;
            pictureBox10.Image = null;
            pictureBox11.Image = null;
            label2.Text        = null;
            TicTac.mp_sign     = 1;
            pictureBox11.Image = null;
            TicTac.FirstPlayer();
            label1.Text        = TicTac.player1;
            pictureBox10.Image = Image.FromFile($"icons\\packs\\pack{pack_id}\\{TicTac.player1_id}.png");

            label2.Text        = TicTac.player2;
            pictureBox11.Image = Image.FromFile($"icons\\packs\\pack{pack_id}\\{TicTac.player2_id}.png");

            //sign++;



            if (TicTac.player1_id == 1)
            {
                MP_Message(TicTac.player1);
            }
            else if (TicTac.player2_id == 1)
            {
                MP_Message(TicTac.player2);
            }


            if (TicTac.player1_id == 1)
            {
                label1.ForeColor = Color.Red;
            }
            else if (TicTac.player2_id == 1)
            {
                label2.ForeColor = Color.Red;
            }
        }
Пример #10
0
        public void Newgame()
        {
            pictureBox1.Image = null;
            pictureBox2.Image = null;
            pictureBox3.Image = null;
            pictureBox4.Image = null;
            pictureBox5.Image = null;
            pictureBox6.Image = null;
            pictureBox7.Image = null;
            pictureBox8.Image = null;
            pictureBox9.Image = null;

            pictureBox10.Image = null;
            pictureBox11.Image = null;
            label1.Text        = null;
            label2.Text        = null;
            is_win             = false;
            TicTac.is_multyp   = false;
            TicTac.mp_sign     = 1;
            sign = TicTac.Creating();
            create_clicked(false);
            pack_id = TicTac.pack();
            create_grid(-1);
        }
Пример #11
0
 static void Main(string[] args)
 {
     TicTac p = new TicTac();
     p.Start();
 }
        static void Main(string[] args)
        {
            TicTac p = new TicTac();

            p.Start();
        }