Exemplo n.º 1
0
 public GameState(Igrac i1, Igrac i2, int t)
 {
     ig1    = i1;
     ig2    = i2;
     turn   = t;
     matrix = new char [8, 8];
     for (int i = 1; i < 8; i++)
     {
         for (int j = 1; j < 8; j++)
         {
             if ((i % 2 == 0) && (j % 2 == 1))
             {
                 matrix[i, j] = '0';
             }
             else if ((i % 2 == 1) && (j % 2 == 0))
             {
                 matrix[i, j] = '0';
             }
             else
             {
                 matrix[i, j] = 'x';
             }
         }
     }
 }
Exemplo n.º 2
0
 public GameState(Igrac i1, Igrac i2, int t, int tIgra)
 {
     ig1     = i1;
     ig2     = i2;
     turn    = t;
     tipIgra = tIgra;
     matrix  = new char [11, 11];
     inicMatrica();
 }
Exemplo n.º 3
0
 public NewGame(Igrac ig1, Igrac ig2)
 {
     InitializeComponent();
     txtRez.Font = new System.Drawing.Font("Ariel", 30);
     lblP1.Font = new System.Drawing.Font("Ariel", 12);
     lblP2.Font = new System.Drawing.Font("Ariel", 12);
     lblP1.ForeColor = ig1.Boja;
     lblP2.ForeColor = ig2.Boja;
     lblP1.Text = ig1.Ime;
     lblP2.Text = ig2.Ime;
     i1 = ig1;
     i2 = ig2;
     gs = new GameState(i1, i2, 1);
 }
Exemplo n.º 4
0
 public NewGame(Igrac ig1, Igrac ig2)
 {
     InitializeComponent();
     txtRez.Font     = new System.Drawing.Font("Ariel", 30);
     lblP1.Font      = new System.Drawing.Font("Ariel", 12);
     lblP2.Font      = new System.Drawing.Font("Ariel", 12);
     lblP1.ForeColor = ig1.Boja;
     lblP2.ForeColor = ig2.Boja;
     lblP1.Text      = ig1.Ime;
     lblP2.Text      = ig2.Ime;
     i1 = ig1;
     i2 = ig2;
     gs = new GameState(i1, i2, 1);
 }
Exemplo n.º 5
0
 private void btnNewGame_Click(object sender, EventArgs e)
 {
     if (panel1.BackColor.Equals(panel2.BackColor))
     {
         MessageBox.Show("Мора да изберете различни бои!");
     }
     else
     {
         ig1 = new Igrac(txtImeP1.Text, panel1.BackColor, 0);
         ig2 = new Igrac(txtImeP2.Text, panel2.BackColor, 0);
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
         NewGame ng = new NewGame(ig1, ig2);
         ng.ShowDialog();
     }
 }
Exemplo n.º 6
0
 private void btnNewGame_Click(object sender, EventArgs e)
 {
     if (panel1.BackColor.Equals(panel2.BackColor))
     {
         MessageBox.Show("Мора да изберете различни бои!");
     }
     else
     {
         ig1 = new Igrac(txtImeP1.Text, panel1.BackColor, 0);
         ig2 = new Igrac(txtImeP2.Text, panel2.BackColor, 0);
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
         NewGame ng = new NewGame(ig1, ig2);
         ng.ShowDialog();
     }
 }
Exemplo n.º 7
0
        public NewGame(Igrac ig1, Igrac ig2, int tipIgra, int turn, int rundi, int brrunda)
        {
            InitializeComponent();
            this.Text = "Рунда " + brrunda;
            dc        = this.CreateGraphics();

            ig1.Score = 0;
            ig2.Score = 0;

            Rundi = rundi;
            Turn  = turn;

            brRunda = brrunda;

            settings(ig1, ig2, turn, tipIgra);
            gs = new GameState(ig1, ig2, turn, tipIgra);
        }
Exemplo n.º 8
0
 public GameState(Igrac i1, Igrac i2, int t)
 {
     ig1 = i1;
     ig2 = i2;
     turn = t;
     matrix = new char [8,8];
     for (int i = 1; i < 8; i++)
     {
         for (int j = 1; j < 8; j++)
         {
             if ((i % 2 == 0) && (j % 2 == 1))
                 matrix[i,j] = '0';
             else if ((i % 2 == 1) && (j % 2 == 0))
                 matrix[i,j] = '0';
             else matrix[i, j] = 'x';
         }
     }
 }
Exemplo n.º 9
0
        public void handlePobeda(Igrac p, int br)
        {
            txtRez.Clear();
            txtRez.AppendText(string.Format("{0}:{1}", gs.ig1.Score, gs.ig2.Score));
            if (br == 1)
            {
                pobP1++;
            }
            else
            {
                pobP2++;
            }

            KraenRez         += string.Format("{0}.                            {1}{2}", brRunda, txtRez.Text, Environment.NewLine);
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            //System.Threading.Thread.Sleep(200);
            this.Dispose();
            if (brRunda + 1 > Rundi)
            {
                string s;
                if (pobP1 > pobP2)
                {
                    s = gs.ig1.Ime;
                }
                else if (pobP1 < pobP2)
                {
                    s = gs.ig2.Ime;
                }
                else
                {
                    s = "Нерешено";
                }
                KraenRezultat kr = new KraenRezultat(KraenRez, pobP1, pobP2, s);
                KraenRez = "";
                pobP1    = 0;
                pobP2    = 0;
                kr.ShowDialog();
            }
            else
            {
                NewGame ng = new NewGame(gs.ig1, gs.ig2, gs.tipIgra, Turn, Rundi, brRunda + 1);
                ng.ShowDialog();
            }
        }
Exemplo n.º 10
0
 private void btnNewGame_Click(object sender, EventArgs e)
 {
     if (panel1.BackColor.Equals(panel2.BackColor))
     {
         MessageBox.Show("Мора да изберете различни бои!", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     if (cBoxTipIgra.SelectedIndex == -1)
     {
         MessageBox.Show("Мора да изберете тип на игра", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
         ig1 = new Igrac(txtImeP1.Text, panel1.BackColor, 0);
         ig2 = new Igrac(txtImeP2.Text, panel2.BackColor, 0);
         NewGame ng = new NewGame(ig1, ig2, cBoxTipIgra.SelectedIndex, turn, Rundi, 1);
         ng.Show();
         //this.Hide();
     }
 }
Exemplo n.º 11
0
        public void settings(Igrac ig1, Igrac ig2, int turn, int tIgra)
        {
            txtRez.Font = new System.Drawing.Font("Ariel", 30);
            txtP1.Text  = ig1.Ime;
            txtP2.Text  = ig2.Ime;
            txtRez.Text = "0:0";
            if (turn == 1)
            {
                txtP1.BackColor = ig1.Boja;
                txtP2.BackColor = Color.WhiteSmoke;
            }
            if (turn == 0)
            {
                txtP1.BackColor = Color.WhiteSmoke;
                txtP2.BackColor = ig2.Boja;
            }

            if (tIgra == 0)
            {
                p01.BackColor = this.BackColor; p03.BackColor = this.BackColor; p05.BackColor = this.BackColor; p07.BackColor = this.BackColor;
                p10.BackColor = this.BackColor; p12.BackColor = this.BackColor; p14.BackColor = this.BackColor; p16.BackColor = this.BackColor; p18.BackColor = this.BackColor;
                p30.BackColor = this.BackColor; p50.BackColor = this.BackColor; p70.BackColor = this.BackColor;
                p21.BackColor = this.BackColor; p41.BackColor = this.BackColor; p61.BackColor = this.BackColor; p81.BackColor = this.BackColor;
                p49.BackColor = this.BackColor; p510.BackColor = this.BackColor; p69.BackColor = this.BackColor;
                p94.BackColor = this.BackColor; p105.BackColor = this.BackColor; p96.BackColor = this.BackColor;
            }
            if (tIgra == 1)
            {
                p49.BackColor = this.BackColor; p510.BackColor = this.BackColor; p69.BackColor = this.BackColor;
                p94.BackColor = this.BackColor; p105.BackColor = this.BackColor; p96.BackColor = this.BackColor;
            }

            if (tIgra == 2)
            {
                p01.BackColor = this.BackColor; p03.BackColor = this.BackColor; p07.BackColor = this.BackColor;
                p10.BackColor = this.BackColor; p12.BackColor = this.BackColor; p18.BackColor = this.BackColor;
                p30.BackColor = this.BackColor; p70.BackColor = this.BackColor;
                p21.BackColor = this.BackColor; p81.BackColor = this.BackColor;
            }
        }