示例#1
0
    //copy constructor
    public Board(Board otherBoard)
    {
        GameBoard       = new sbyte[BoardSize, BoardSize];
        PlayerPositions = new Move[2];
        Walls           = new byte[2];

        Buffer.BlockCopy(otherBoard.GameBoard, 0, GameBoard, 0, 100);

        PlayerPositions[0] = new Move(otherBoard.PlayerPositions[0]);
        PlayerPositions[1] = new Move(otherBoard.PlayerPositions[1]);

        Current    = otherBoard.Current;
        NotCurrent = otherBoard.NotCurrent;
        Turns      = otherBoard.Turns;
        Validator  = new WallValidation();

        Walls[0] = otherBoard.Walls[0];
        Walls[1] = otherBoard.Walls[1];
    }
示例#2
0
    //constructor
    public Board()
    {
        GameBoard       = new sbyte[BoardSize, BoardSize];
        Walls           = new byte[2];
        PlayerPositions = new Move[] {
            new Move(9, 5, 0),
            new Move(1, 5, 0)
        };

        Validator = new WallValidation();

        //build walls around border
        //top
        for (int i = 0; i < 10; i++)
        {
            GameBoard[0, i] = 1;
        }
        //bottom
        for (int i = 0; i < 10; i++)
        {
            GameBoard[9, i] = 1;
        }
        //left
        for (int i = 0; i < 10; i++)
        {
            GameBoard[i, 0] = -1;
        }
        //right
        for (int i = 0; i < 10; i++)
        {
            GameBoard[i, 9] = -1;
        }

        Turns      = 0;
        Current    = 0;
        NotCurrent = 1;
        for (int i = 0; i <= 1; i++)
        {
            Walls[i] = 10;
        }
    }