private void CreatingNewGrid() { canvas.Dimensions = new SizeF(GridSize.Width + 0.2f, GridSize.Height + 0.2f); solver = null; solution = null; canvas.Refresh(); }
private void buttonSolveForced_Click(object sender, EventArgs e) { Solver.GridState s = new Solver.GridState(grid); s.MakeForcedMoves(); solution = s; canvas.Refresh(); }
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { solution = solver.SolveConnections(backgroundWorker); if (backgroundWorker.CancellationPending) { e.Cancel = true; } }
private void buttonResetSolver_Click(object sender, EventArgs e) { solver = null; solution = null; canvas.Refresh(); buttonSolve.Enabled = buttonNextState.Enabled; CheckForValidity(); }
private void buttonNextState_Click(object sender, EventArgs e) { if (solver == null) { solver = new Solver(grid); } solution = solver.NextState(); canvas.Refresh(); if (solution.Solved) { buttonSolve.Enabled = buttonNextState.Enabled = false; } }