Link() public method

public Link ( Square neighbour, Direction dir ) : void
neighbour Square
dir Direction
return void
        // end::createBoard[]

        // tag::setLink[]
        private void SetLink(Square square, Direction dir, int x, int y,
            int width, int height, Square[,] grid) {
            int dirX = (width + x + dir.DeltaX) % width;
            int dirY = (height + y + dir.DeltaY) % height;
            Square neighbour = grid[dirX,dirY];
            square.Link(neighbour, dir);
        }
        // end::createBoard[]

        // tag::setLink[]
        private void SetLink(Square square, Direction dir, int x, int y,
                             int width, int height, Square[,] grid)
        {
            int    dirX      = (width + x + dir.DeltaX) % width;
            int    dirY      = (height + y + dir.DeltaY) % height;
            Square neighbour = grid[dirX, dirY];

            square.Link(neighbour, dir);
        }