示例#1
0
    private void Init()
    {
        for (int i = 0; i < Players.Length; i++)
        {
            var player = Players[i];
            if (player.Color == PieceColor.White)
            {
                for (int j = 0; j < Spots.GetLength(1); j++)
                {
                    Spots[1, i] = new Spot(1, i, new Pawn());
                }

                Spots[0, 0] = new Spot(0, 0, new Rook());
                Spots[0, 7] = new Spot(0, 7, new Rook());
                Spots[0, 1] = new Spot(0, 1, new Knight());
                Spots[0, 6] = new Spot(0, 6, new Knight());
                Spots[0, 2] = new Spot(0, 2, new Bishop());
                Spots[0, 5] = new Spot(0, 5, new Bishop());
                Spots[0, 3] = new Spot(0, 3, new Queen());
                Spots[0, 4] = new Spot(0, 4, new King());
            }

            if (player.Color == PieceColor.Black)
            {
                for (int j = 0; j < Spots.GetLength(1); j++)
                {
                    Spots[6, i] = new Spot(6, i, new Pawn());
                }

                Spots[7, 0] = new Spot(7, 0, new Rook());
                Spots[7, 7] = new Spot(7, 7, new Rook());
                Spots[7, 1] = new Spot(7, 1, new Knight());
                Spots[7, 6] = new Spot(7, 6, new Knight());
                Spots[7, 2] = new Spot(7, 2, new Bishop());
                Spots[7, 5] = new Spot(7, 5, new Bishop());
                Spots[7, 3] = new Spot(7, 3, new Queen());
                Spots[7, 4] = new Spot(7, 4, new King());
            }
        }
    }
示例#2
0
 public int CountLeds(int spotsX, int spotsY)
 {
     return(Spots.GetLength(0));
 }