Exemplo n.º 1
0
        public void LoadStones()
        {
            Reds.Add(FormGame.Red_Kamen_01);
            Reds.Add(FormGame.Red_Kamen_02);
            Reds.Add(FormGame.Red_Kamen_03);
            Reds.Add(FormGame.Red_Kamen_04);
            Reds.Add(FormGame.Red_Kamen_05);
            Reds.Add(FormGame.Red_Kamen_06);
            Reds.Add(FormGame.Red_Kamen_07);
            Reds.Add(FormGame.Red_Kamen_08);
            Reds.Add(FormGame.Red_Kamen_09);
            Reds.Add(FormGame.Red_Kamen_10);
            Reds.Add(FormGame.Red_Kamen_11);
            Reds.Add(FormGame.Red_Kamen_12);

            Blues.Add(FormGame.Blue_Kamen_01);
            Blues.Add(FormGame.Blue_Kamen_02);
            Blues.Add(FormGame.Blue_Kamen_03);
            Blues.Add(FormGame.Blue_Kamen_04);
            Blues.Add(FormGame.Blue_Kamen_05);
            Blues.Add(FormGame.Blue_Kamen_06);
            Blues.Add(FormGame.Blue_Kamen_07);
            Blues.Add(FormGame.Blue_Kamen_08);
            Blues.Add(FormGame.Blue_Kamen_09);
            Blues.Add(FormGame.Blue_Kamen_10);
            Blues.Add(FormGame.Blue_Kamen_11);
            Blues.Add(FormGame.Blue_Kamen_12);
        }
Exemplo n.º 2
0
        public bool TestPattern(Point center, MapRecord map)
        {
            try
            {
                bool bluesOk;
                bool redsOk;
                if (Relativ)
                {
                    bluesOk = Blues.All(entry => GetCell(map, entry.X + center.X, entry.Y + center.Y).Walkable &&
                                        !GetCell(map, entry.X + center.X, entry.Y + center.Y).NonWalkableDuringFight);
                    redsOk = Reds.All(entry => GetCell(map, entry.X + center.X, entry.Y + center.Y).Walkable &&
                                      !GetCell(map, entry.X + center.X, entry.Y + center.Y).NonWalkableDuringFight);
                }
                else
                {
                    bluesOk = Blues.All(entry => GetCell(map, entry.X, entry.Y).Walkable &&
                                        !GetCell(map, entry.X, entry.Y).NonWalkableDuringFight);
                    redsOk = Reds.All(entry => GetCell(map, entry.X, entry.Y).Walkable &&
                                      !GetCell(map, entry.X, entry.Y).NonWalkableDuringFight);
                }

                return(bluesOk && redsOk);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        public void Delete(Button stone, Rectangle field)
        {
            Point skoceny;

            int puvodniRow   = Grid.GetRow(stone);
            int puvodniColum = Grid.GetColumn(stone);

            int novyRow   = Grid.GetRow(field);
            int novyColum = Grid.GetColumn(field);

            //string barva = kamen.Name.Split('_')[0];

            skoceny = new Point((puvodniColum + novyColum) / 2, (puvodniRow + novyRow) / 2);

            foreach (Button item in Reds)
            {
                if (Grid.GetRow(item) == skoceny.Y && Grid.GetColumn(item) == skoceny.X)
                {
                    Reds.Remove(item);
                    item.Visibility = Visibility.Hidden;
                    return;
                }
            }
            foreach (Button item in Blues)
            {
                if (Grid.GetRow(item) == skoceny.Y && Grid.GetColumn(item) == skoceny.X)
                {
                    Blues.Remove(item);
                    item.Visibility = Visibility.Hidden;
                    return;
                }
            }
        }
Exemplo n.º 4
0
        public void Reset()
        {
            Reds.Clear();
            Blacks.Clear();
            JumpRequiredRed   = false;
            JumpRequiredBlack = false;
            Player            = "Red";
            Array.Clear(GameBoard, 0, GameBoard.Length);
            int id = 0;

            for (int row = 0; row < 3; row++)
            {
                for (int col = 0; col < 8; col += 2)
                {
                    int index = row % 2 == 0 ? col + 1 + 8 * row : col + 8 * row;

                    Piece black = new Piece(row, index % 8, 'B', 'B', id);
                    Piece red   = new Piece(7 - row, 7 - index % 8, 'R', 'R', id);
                    GameBoard[black.Row, black.ColInt] = black;
                    Blacks.Add(black);
                    GameBoard[red.Row, red.ColInt] = red;
                    Reds.Add(red);
                    id++;
                }
            }
        }
Exemplo n.º 5
0
 public void DeletePiece()
 {
     if (Player == "Red")
     {
         Remove = 0;
         foreach (Piece black in Blacks)
         {
             if (GameBoard[(Row + TargetRow) / 2, (Col + TargetCol) / 2].ID == black.ID)
             {
                 break;
             }
             Remove++;
         }
         Blacks.RemoveAt(Remove);
     }
     else if (Player == "Black")
     {
         Remove = 0;
         foreach (Piece red in Reds)
         {
             if (GameBoard[(Row + TargetRow) / 2, (Col + TargetCol) / 2].ID == red.ID)
             {
                 break;
             }
             Remove++;
         }
         Reds.RemoveAt(Remove);
     }
 }
Exemplo n.º 6
0
 public void CheckWinner()
 {
     Player = !Reds.Any() ? "Black" : "Red";
 }
Exemplo n.º 7
0
 public bool CheckGameOver()
 {
     return(!Reds.Any() || !Blacks.Any());
 }
Exemplo n.º 8
0
 /// <summary>
 /// Copies this instance's RGB arrays to the RGB arrays of another instance.
 /// </summary>
 /// <param name="copyTo"></param>
 public void CopyTo(PaletteSet copyTo)
 {
     Reds.CopyTo(copyTo.Reds, 0);
     Greens.CopyTo(copyTo.Greens, 0);
     Blues.CopyTo(copyTo.Blues, 0);
 }