/// <summary> /// Initializes a new instance of the SudokuSolver.SudokuGrid class. /// </summary> public SudokuGrid(int width, int height, int size, BlockFlag gameMode = new BlockFlag()) { this.width = width; this.height = height; this.size = size; this.cells = GridOperations.Create(size); var movement = new Movement(cells); this.mapping = new Dictionary <Direction, Func <SudokuCell, SudokuCell> > { { Direction.Up, cell => movement.Up(cell) }, { Direction.Down, cell => movement.Down(cell) }, { Direction.Left, cell => movement.Left(cell) }, { Direction.Right, cell => movement.Right(cell) }, { Direction.JumpForward, cell => movement.JumpForward(cell) }, { Direction.JumpBackward, cell => movement.JumpBackward(cell) } }; this.neighbors = Block.FindNeighbors(this, gameMode); this.activeCell = cells[0, 0]; }
private void UpdateOrientationPanel(int number) { // Get orientation options. orientationPanel.Controls.Clear(); foreach (var factor in GridOperations.GetFactors(number)) { RadioButton orientationButton = new RadioButton() { Dock = DockStyle.Fill, Font = defaultOrientationButton.Font, Tag = factor, Text = $"{factor.First}x{factor.Second}" }; orientationButton.CheckedChanged += orientationButton_CheckedChanged; // If this is the first orientation button, mark it as checked. if (orientationPanel.Controls.Count == 0) { orientationButton.Checked = true; } orientationPanel.Controls.Add(orientationButton); } }