Exemple #1
0
        public BoardVM CreateNewBoard(SolidColorBrush whiteColor, SolidColorBrush blackColor)
        {
            BoardVM board = new BoardVM();
            List<char> files = new List<char>() { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H' };
            List<int> ranks = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8 };

            foreach (char file in files)
            {
                foreach (int rank in ranks)
                {
                    SolidColorBrush color = Brushes.Transparent;
                    if (file == 'A' || file == 'C' || file == 'E' || file == 'G')
                    {
                        if (rank % 2 == 0) color = whiteColor;
                        else color = blackColor;
                    }
                    else
                    {
                        if (rank % 2 == 0) color = blackColor;
                        else color = whiteColor;
                    }
                    board.AddSquare(new BoardSquareVM(file, rank, color));
                }
            }
            return board;
        }
Exemple #2
0
 public static This CreateNewGame()
 {
     This game = new This();
     This.Images = new Images();
     This.Board = game.CreateNewBoard(Brushes.BlanchedAlmond, Brushes.Chocolate);
     return game;
 }