コード例 #1
0
        // tag::createBoard[]
        public Board CreateBoard(Square[,] grid)
        {
            Debug.Assert(grid != null);

            Board board = new Board(grid);

            int width = board.Width;
            int height = board.Height;
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    Square square = grid[x, y];
                    foreach (Direction dir in Direction.Values)
                    {
                        int dirX = (width + x + dir.DeltaX) % width;
                        int dirY = (height + y + dir.DeltaY) % height;
                        Square neighbour = grid[dirX, dirY];
                        square.Link(neighbour, dir);
                    }
                }
            }

            return board;
        }
コード例 #2
0
 public void link(Square neighbour, Direction dir)
 {
 }
コード例 #3
0
 public Board(Square[,] grid)
 {
 }