Ejemplo n.º 1
0
        public Board()
        {
            pieces = new Pieces();

            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    boardRect[i, j] = new Rectangle(i * 100, j * 100, 100, 100);
                }
            }
        }
Ejemplo n.º 2
0
        public void GeneratePieceInfo()
        {
            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    switch (boardLayout[i][j])
                    {
                    case 0: piecesList[i, j] = new Pieces {
                            piece = "", pieceColor = "none", pieceCoord = new int[] { j, i }
                    }; break;                                                                                                              // piece = "" because I print color then piece so this is to avoid "none none"

                    case 1: piecesList[i, j] = new Pieces {
                            piece = "rook", pieceColor = "black", pieceCoord = new int[] { j, i }
                    }; break;

                    case 2: piecesList[i, j] = new Pieces {
                            piece = "knight", pieceColor = "black", pieceCoord = new int[] { j, i }
                    }; break;

                    case 3: piecesList[i, j] = new Pieces {
                            piece = "bishop", pieceColor = "black", pieceCoord = new int[] { j, i }
                    }; break;

                    case 4: piecesList[i, j] = new Pieces {
                            piece = "queen", pieceColor = "black", pieceCoord = new int[] { j, i }
                    }; break;

                    case 5: piecesList[i, j] = new Pieces {
                            piece = "king", pieceColor = "black", pieceCoord = new int[] { j, i }
                    }; break;

                    case 6: piecesList[i, j] = new Pieces {
                            piece = "pawn", pieceColor = "black", pieceCoord = new int[] { j, i }
                    }; break;

                    case 7: piecesList[i, j] = new Pieces {
                            piece = "pawn", pieceColor = "white", pieceCoord = new int[] { j, i }
                    }; break;

                    case 8: piecesList[i, j] = new Pieces {
                            piece = "rook", pieceColor = "white", pieceCoord = new int[] { j, i }
                    }; break;

                    case 9: piecesList[i, j] = new Pieces {
                            piece = "knight", pieceColor = "white", pieceCoord = new int[] { j, i }
                    }; break;

                    case 10: piecesList[i, j] = new Pieces {
                            piece = "bishop", pieceColor = "white", pieceCoord = new int[] { j, i }
                    }; break;

                    case 11: piecesList[i, j] = new Pieces {
                            piece = "queen", pieceColor = "white", pieceCoord = new int[] { j, i }
                    }; break;

                    case 12: piecesList[i, j] = new Pieces {
                            piece = "king", pieceColor = "white", pieceCoord = new int[] { j, i }
                    }; break;

                    default: break;
                    }
                }
            }
        }