internal BoardCreator (Square[,] grid) { Debug.Assert (grid != null); this.grid = grid; this.board = new Board (grid); this.width = board.Width; this.height = board.Height; }
public Board(Square[,] grid) { }
public void Link(Square neighbour, Direction dir) { }
// tag::createBoard[] public Board CreateBoard(Square[,] grid) { return new BoardCreator(grid).Create(); }
private void SetLink(Square square, Direction dir, int x, int y) { int dirX = (width + x + dir.DeltaX) % width; int dirY = (height + y + dir.DeltaY) % height; Square neighbour = grid[dirX, dirY]; square.Link(neighbour, dir); }