コード例 #1
0
ファイル: King.cs プロジェクト: SukiTKChan/FYP
 public King(Colour pieceColour, PositionOnBoard positionOnBoard, BoardAI boardAI)
 {
     color    = pieceColour;
     position = positionOnBoard;
     pieceID  = color == Colour.Black ? 1 : 2;
     LinktoBoard(boardAI);
 }
コード例 #2
0
ファイル: Pawn.cs プロジェクト: SukiTKChan/FYP
 internal Pawn(Colour pieceColour, PositionOnBoard positionOnBoard, BoardAI boardAI)
 {
     color    = pieceColour;
     position = positionOnBoard;
     pieceID  = color == Colour.Black ? 13 : 14;
     LinktoBoard(boardAI);
 }
コード例 #3
0
 internal Cannon(Colour pieceColour, PositionOnBoard positionOnBoard, BoardAI boardAI)
 {
     color    = pieceColour;
     position = positionOnBoard;
     pieceID  = color == Colour.Black ? 11 : 12;
     LinktoBoard(boardAI);
 }
コード例 #4
0
 internal Bishop(Colour pieceColour, PositionOnBoard positionOnBoard, BoardAI boardAI)
 {
     color    = pieceColour;
     position = positionOnBoard;
     pieceID  = color == Colour.Black ? 5 : 6;
     LinktoBoard(boardAI);
 }
コード例 #5
0
ファイル: Rook.cs プロジェクト: SukiTKChan/FYP
 internal Rook(Colour pieceColour, PositionOnBoard positionOnBoard, BoardAI boardAI)
 {
     color    = pieceColour;
     position = positionOnBoard;
     pieceID  = color == Colour.Black ? 9 : 10;
     LinktoBoard(boardAI);
 }
コード例 #6
0
 internal Knight(Colour pieceColour, PositionOnBoard positionOnBoard, BoardAI boardAI)
 {
     color    = pieceColour;
     position = positionOnBoard;
     pieceID  = color == Colour.Black ? 7 : 8;
     LinktoBoard(boardAI);
 }
コード例 #7
0
    // Use this for initialization
    void Start()
    {
        board = gameObject.GetComponent <Board>();
        board.CreateBoard();
        boardAI = new BoardAI(9, 10);

        //List<PositionOnBoard> ans =  boardAI.theboard[4, 8].LegalMoves();
    }
コード例 #8
0
ファイル: PieceControl.cs プロジェクト: SukiTKChan/FYP
 internal void LinktoBoard(BoardAI boardAI)
 {
     theBoard = boardAI;
 }
コード例 #9
0
 public void PrepareForOffline(int boardAILevel)
 {
     currentBoardAI = prefabsBoardAIs[boardAILevel].GetComponent <BoardAI>();
 }
コード例 #10
0
ファイル: BoardAI.cs プロジェクト: SukiTKChan/FYP
    internal PieceControl[,] boardFor(int[,] boardFromInts)
    {
        BoardAI newBoard = new BoardAI(numberofColumns, numberOfRows);

        PieceControl[,] placeHolder = new PieceControl[numberofColumns, numberOfRows];

        for (int col = 0; col < numberofColumns; col++)
        {
            for (int row = 0; row < numberOfRows; row++)
            {
                switch (boardFromInts[col, row])
                {
                case 0:

                    placeHolder[col, row] = new BlankSpace(new PositionOnBoard(col, row));
                    break;

                case 1:

                    placeHolder[col, row] = new King(PieceControl.Colour.Black, new PositionOnBoard(col, row), newBoard);
                    break;

                case 2:

                    placeHolder[col, row] = new King(PieceControl.Colour.Red, new PositionOnBoard(col, row), newBoard);
                    break;

                case 3:

                    placeHolder[col, row] = new Guard(PieceControl.Colour.Black, new PositionOnBoard(col, row), newBoard);
                    break;

                case 4:

                    placeHolder[col, row] = new Guard(PieceControl.Colour.Red, new PositionOnBoard(col, row), newBoard);
                    break;

                case 5:

                    placeHolder[col, row] = new Bishop(PieceControl.Colour.Black, new PositionOnBoard(col, row), newBoard);
                    break;

                case 6:

                    placeHolder[col, row] = new Bishop(PieceControl.Colour.Red, new PositionOnBoard(col, row), newBoard);
                    break;

                case 7:

                    placeHolder[col, row] = new Knight(PieceControl.Colour.Black, new PositionOnBoard(col, row), newBoard);
                    break;

                case 8:

                    placeHolder[col, row] = new Knight(PieceControl.Colour.Black, new PositionOnBoard(col, row), newBoard);
                    break;

                case 9:

                    placeHolder[col, row] = new Rook(PieceControl.Colour.Black, new PositionOnBoard(col, row), newBoard);
                    break;

                case 10:

                    placeHolder[col, row] = new Rook(PieceControl.Colour.Red, new PositionOnBoard(col, row), newBoard);
                    break;

                case 11:

                    placeHolder[col, row] = new Cannon(PieceControl.Colour.Black, new PositionOnBoard(col, row), newBoard);
                    break;

                case 12:

                    placeHolder[col, row] = new Cannon(PieceControl.Colour.Red, new PositionOnBoard(col, row), newBoard);
                    break;

                case 13:

                    placeHolder[col, row] = new Pawn(PieceControl.Colour.Black, new PositionOnBoard(col, row), newBoard);
                    break;

                case 14:

                    placeHolder[col, row] = new Pawn(PieceControl.Colour.Red, new PositionOnBoard(col, row), newBoard);
                    break;
                }
            }
        }

        return(placeHolder);
    }