コード例 #1
0
        public static void SetStatusTextAndIcon(StatusBarPanel statusBarPanel, SolveState solveState)
        {
            string str = null;
            Icon   ic  = UI.IMAGES.NOT_SOLVED_ICON;

            if (solveState.Equals(SolveState.NotSolved))
            {
                str = "Not Solved";
                ic  = UI.IMAGES.NOT_SOLVED_ICON;
            }
            else if (solveState.Equals(SolveState.PartiallySolved))
            {
                str = "Partially Solved";
                ic  = UI.IMAGES.PARTIALLY_SOLVED_ICON;
            }
            else if (solveState.Equals(SolveState.Solved))
            {
                str = "Solved";
                ic  = UI.IMAGES.SOLVED_ICON;
            }
            else if (solveState.Equals(SolveState.SolveFailed))
            {
                str = "Solve Failed";
                ic  = UI.IMAGES.SOLVE_FAILED_ICON;
            }

            statusBarPanel.Text = str;
            statusBarPanel.Icon = ic;
        }
コード例 #2
0
ファイル: GameEngine.cs プロジェクト: psdimitrov/Sudoku
        private void MainMenu_ButtonClicked(object sender, ButtonClickedEventArgs eventargs)
        {
            switch (eventargs.Button)
            {
            case ButtonNames.Play:
                var newGameState = new GameState(StateManager.CurrentState, eventargs.Time);
                newGameState.LoadButtons();
                StateManager.CurrentState = newGameState;
                break;

            case ButtonNames.Solve:
                var newSolveState = new SolveState(StateManager.CurrentState);
                newSolveState.LoadButtons();
                StateManager.CurrentState = newSolveState;
                break;

            case ButtonNames.Help:
                var newHelpState = new HelpState(StateManager.CurrentState);
                newHelpState.LoadButtons();
                StateManager.CurrentState = newHelpState;
                break;

            case ButtonNames.About:
                var newAboutState = new AboutState(StateManager.CurrentState);
                newAboutState.LoadButtons();
                StateManager.CurrentState = newAboutState;
                break;
            }
        }
コード例 #3
0
        public AStarPathfinding(Cell[,] _grid)
        {
            //SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            w = MainForm.gridSize * MainForm.m;
            InitializeComponent();
            DoubleBuffered = true;
            OpenSet        = new AVLTree <Cell>();
            solveState     = SolveState.FIND;

            this.ClientSize = new Size(800, w);

            this.targetPos = new Point(MainForm.target.X, MainForm.target.Y);
            this.startPos  = new Point(MainForm.start.X, MainForm.start.Y);

            grid   = _grid;
            speed  = (int)Math.Ceiling(MainForm.speed / 10f);
            target = grid[targetPos.X, targetPos.Y];

            grid[startPos.X, startPos.Y].gScore = 0;
            grid[startPos.X, startPos.Y].Open   = State.OPENED;
            grid[startPos.X, startPos.Y].fScore = grid[startPos.X, startPos.Y].hScore * heuristic + grid[startPos.X, startPos.Y].gScore;

            OpenSet.Add(grid[startPos.X, startPos.Y]);

            tick_timer.Start();
            start = DateTime.Now;
            time_record.Start();
        }
コード例 #4
0
        public MainForm()
        {
            InitializeComponent();
            //SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            DoubleBuffered  = true;
            OpenSet         = new AVLTree <Cell>();
            solveState      = SolveState.FIND;
            gridSize        = w / m;
            grid            = new Cell[gridSize, gridSize];
            this.ClientSize = new Size(w, h);
            Random rnd = new Random();

            for (int i = 0; i < gridSize; i++)
            {
                for (int k = 0; k < gridSize; k++)
                {
                    grid[i, k] = new Cell(i, k, m, (rnd.Next(1, 100) > 35), new Vec2(i, k));
                }
            }


            target = grid[gridSize - 1, gridSize - 1];
            grid[0, 0].walkable = true;
            grid[gridSize - 1, gridSize - 1].walkable = true;

            grid[0, 0].gScore = 0;
            grid[0, 0].Open   = State.OPENED;
            grid[0, 0].fScore = grid[0, 0].hScore + grid[0, 0].gScore;

            OpenSet.Add(grid[0, 0]);

            tick_timer.Start();
        }
コード例 #5
0
        void reset()
        {
            tick_timer.Stop();
            //SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            OpenSet    = new AVLTree <Cell>();
            solveState = SolveState.FIND;
            Vec2 t = new Vec2(target.i, target.k);

            for (int i = 0; i < MainForm.gridSize; i++)
            {
                for (int k = 0; k < MainForm.gridSize; k++)
                {
                    grid[i, k] = new Cell(i, k, MainForm.m, grid[i, k].walkable, t);
                }
            }

            target = grid[targetPos.X, targetPos.Y];
            grid[startPos.X, startPos.Y].gScore = 0;
            grid[startPos.X, startPos.Y].Open   = State.OPENED;
            grid[startPos.X, startPos.Y].fScore = grid[startPos.X, startPos.Y].hScore * heuristic + grid[startPos.X, startPos.Y].gScore;

            OpenSet.Add(grid[startPos.X, startPos.Y]);


            this.pathTiles           = 0;
            this.pathLabel.Text      = "0";
            this.checkedTiles        = 0;
            this.checkedLabel.Text   = "0";
            this.heuristic           = heuristicTrackBar.Value / 100;
            this.tick_timer.Interval = 1001 - this.speedTrackBar.Value;

            tick_timer.Start();
            start = DateTime.Now;
            time_record.Start();
        }
コード例 #6
0
        void reset()
        {
            tick_timer.Stop();
            //SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            solveState = SolveState.FIND;
            Vec2 t = new Vec2(target.i, target.k);

            for (int i = 0; i < MainForm.gridSize; i++)
            {
                for (int k = 0; k < MainForm.gridSize; k++)
                {
                    grid[i, k] = new Cell(i, k, MainForm.m, grid[i, k].walkable, t);
                }
            }

            this.queue  = new Stack <Cell>();
            this.target = grid[targetPos.X, targetPos.Y];
            speed       = (int)Math.Ceiling(MainForm.speed / 10f);

            grid[startPos.X, startPos.Y].Open   = State.CLOSED;
            grid[startPos.X, startPos.Y].gScore = 0;
            queue.Push(grid[startPos.X, startPos.Y]);

            this.pathTiles         = 0;
            this.pathLabel.Text    = "0";
            this.checkedTiles      = 0;
            this.checkedLabel.Text = "0";

            this.tick_timer.Interval = 1001 - this.speedTrackBar.Value;

            tick_timer.Start();
            start = DateTime.Now;
            time_record.Start();
        }
コード例 #7
0
        private void cyclone_SolveComplete(object sender, SolveState solveState)
        {
            CycloneRatingModel rating = (sender as Cyclone).CurrentRatingModel;

            this.SetInletConfiguration(rating.InletConfiguration);
            this.SetParticleTypeGroup(rating.ParticleTypeGroup);
        }
コード例 #8
0
 private void psychrometricChartModel_SolveComplete(object sender, SolveState solveState)
 {
     if (solveState.Equals(SolveState.Solved) || solveState.Equals(SolveState.SolvedWithWarning))
     {
         if (this.psychrometricChartModel.HCType == HCType.GasState)
         {
             this.UpdateCurrentState();
         }
         else if (this.psychrometricChartModel.HCType == HCType.IsenthalpicProcess)
         {
             this.UpdateProcess();
         }
     }
     else
     {
         this.ResetActivity();
         if (this.psychrometricChartModel.HCType == HCType.GasState)
         {
             this.currentState = new HumidityChartState(HCStateType.CurrentState, flowsheet);
             this.UpdateCurrentState();
         }
         else if (this.psychrometricChartModel.HCType == HCType.IsenthalpicProcess)
         {
             this.process = new HumidityChartProcess(this.flowsheet);
             this.UpdateProcess();
         }
     }
 }
コード例 #9
0
        private void heatExchanger_SolveComplete(object sender, SolveState solveState)
        {
            HXRatingModel     ratingModel   = (sender as HeatExchanger).CurrentRatingModel as HXRatingModel;
            FlowDirectionType flowDirection = ratingModel.FlowDirection;

            this.SetFlowDirection(flowDirection);
        }
コード例 #10
0
        /// <summary>
        /// Adds the given direction to the currently active path, and starts a new path if that finishes that pipe.
        /// </summary>
        /// <param name="d">The direction to add</param>
        public void AddDirectionToCurrentPath(Path.Direction d)
        {
            pathsOfColors.Last().Add(d);
            if (grid[pathsOfColors.Last().lastPoint.Y, pathsOfColors.Last().lastPoint.X] == pathsOfColors.Last().color)
            {
                if (pathsOfColors.Count < startNodes.Length)
                {
                    pathsOfColors.Add(new Path(startNodes[pathsOfColors.Count], colors[1 + Array.IndexOf(colors, pathsOfColors.Last().color)]));
                }
                else
                {
                    bool successful = true;
                    foreach (int i in FlattenGrid())
                    {
                        if (i == -1)
                        {
                            successful = false;
                        }
                    }

                    if (successful)
                    {
                        state = SolveState.Success;
                    }
                    else
                    {
                        state = SolveState.Failed;
                    }
                }
            }
        }
コード例 #11
0
        private void heatExchanger_SolveComplete(object sender, SolveState solveState)
        {
            HXRatingModelShellAndTube rating = (sender as HeatExchanger).CurrentRatingModel as HXRatingModelShellAndTube;

            this.SetTubeLayout(rating.TubeLayout);
            this.SetShellType(rating.ShellType);
        }
コード例 #12
0
 public static void SetStatusTextAndColor(Label label, SolveState solveState)
 {
     UI ui = new UI();
      string str = null;
      Color col = ui.COLOR_NOT_SOLVED;
      if (solveState.Equals(SolveState.NotSolved))
      {
     str = "Not Solved";
     col = ui.COLOR_NOT_SOLVED;
      }
      else if (solveState.Equals(SolveState.SolvedWithWarning))
      {
     str = "Solved with Warnings";
     col = ui.COLOR_SOLVED_WITH_WARNING;
      }
      else if (solveState.Equals(SolveState.Solved))
      {
     str = "Solved";
     col = ui.COLOR_SOLVED;
      }
      else if (solveState.Equals(SolveState.SolveFailed))
      {
     str = "Solve Failed";
     col = ui.COLOR_SOLVE_FAILED;
      }
      label.BackColor = col;
      label.Text = str;
 }
コード例 #13
0
        public static void SetStatusTextAndColor(Label label, SolveState solveState)
        {
            UI     ui  = new UI();
            string str = null;
            Color  col = ui.COLOR_NOT_SOLVED;

            if (solveState.Equals(SolveState.NotSolved))
            {
                str = "Not Solved";
                col = ui.COLOR_NOT_SOLVED;
            }
            else if (solveState.Equals(SolveState.PartiallySolved))
            {
                str = "Partially Solved";
                col = ui.COLOR_PARTIALLY_SOLVED;
            }
            else if (solveState.Equals(SolveState.Solved))
            {
                str = "Solved";
                col = ui.COLOR_SOLVED;
            }
            else if (solveState.Equals(SolveState.SolveFailed))
            {
                str = "Solve Failed";
                col = ui.COLOR_SOLVE_FAILED;
            }
            label.BackColor = col;
            label.Text      = str;
        }
コード例 #14
0
 //constructor
 protected Solvable(string s, UnitOpSystem aSystem) : base()
 {
     this.name            = s;
     this.unitOpSystem    = aSystem;
     this.solveController = aSystem.SequentialSolvingController;
     solveState           = SolveState.NotSolved;
 }
コード例 #15
0
        public DFS(Cell[,] _grid)
        {
            //SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            InitializeComponent();
            w = MainForm.gridSize * MainForm.m;
            DoubleBuffered  = true;
            solveState      = SolveState.FIND;
            this.queue      = new Stack <Cell>();
            this.grid       = _grid;
            this.ClientSize = new Size(800, w);
            this.targetPos  = new Point(MainForm.target.X, MainForm.target.Y);
            this.startPos   = new Point(MainForm.start.X, MainForm.start.Y);

            this.target = grid[targetPos.X, targetPos.Y];
            speed       = (int)Math.Ceiling(MainForm.speed / 10f);


            tick_timer.Start();
            start = DateTime.Now;
            time_record.Start();

            grid[startPos.X, startPos.Y].Open   = State.CLOSED;
            grid[startPos.X, startPos.Y].gScore = 0;
            queue.Push(grid[startPos.X, startPos.Y]);
        }
コード例 #16
0
        public static void SetStatusTextAndIcon(StatusBarPanel statusBarPanel, SolveState solveState)
        {
            string str = null;
             Icon ic = UI.IMAGES.NOT_SOLVED_ICON;
             if (solveState.Equals(SolveState.NotSolved))
             {
            str = "Not Solved";
            ic = UI.IMAGES.NOT_SOLVED_ICON;
             }
             else if (solveState.Equals(SolveState.SolvedWithWarning))
             {
            str = "Solved with Warnings";
            ic = UI.IMAGES.SOLVED_WITH_WARNING_ICON;
             }
             else if (solveState.Equals(SolveState.Solved))
             {
            str = "Solved";
            ic = UI.IMAGES.SOLVED_ICON;
             }
             else if (solveState.Equals(SolveState.SolveFailed))
             {
            str = "Solve Failed";
            ic = UI.IMAGES.SOLVE_FAILED_ICON;
             }

             statusBarPanel.Text = str;
             statusBarPanel.Icon = ic;
        }
コード例 #17
0
 //the scope of this method is internal in stead of protected is because
 //PsychrometricChartModel needs to call this method on its streams
 internal void OnSolveComplete(SolveState solveState)
 {
     this.solveState = solveState;
     if (SolveComplete != null)
     {
         SolveComplete(this, solveState);
     }
 }
コード例 #18
0
        private void heatExchanger_SolveComplete(object sender, SolveState solveState)
        {
            HXRatingModelShellAndTube ratingModel = (sender as HeatExchanger).CurrentRatingModel as HXRatingModelShellAndTube;

            this.checkBoxIncludeWallEffect.Checked   = ratingModel.IncludeWallEffect;
            this.checkBoxIncludeNozzleEffect.Checked = ratingModel.IncludeNozzleEffect;
            this.SetRatingType(ratingModel.ShellRatingType);
        }
コード例 #19
0
 public static SolveState OnMoveSelected(SolveState state, MoveSelectedAction action)
 {
     return(state with
     {
         CurrentMove = action.Move,
         CurrentMoveIndex = state.Moves.IndexOf(action.Move),
         Board = action.Move.Board
     });
 }
コード例 #20
0
        public static SolveState OnSolveAction(SolveState _)
        {
            var state = GetResetSolveState();

            return(state with
            {
                IsLoading = true
            });
        }
コード例 #21
0
 //the scope of this method is internal in stead of protected is because
 //PsychrometricChartModel needs to call this method on its streams
 internal void OnSolveComplete(SolveState currentSolveState)
 {
     //if (currentSolveState != solveState) {
     this.solveState = currentSolveState;
     if (SolveComplete != null)
     {
         SolveComplete(this, solveState);
     }
     //}
 }
コード例 #22
0
        public static SolveState OnFailedToSolveResult(SolveState _)
        {
            var state = GetResetSolveState();

            return(state with
            {
                SolutionAttempted = true,
                FoundSolution = false
            });
        }
コード例 #23
0
        void Tick_timerTick(object sender, EventArgs e)
        {
            for (int i = 0; i < 10; i++)
            {
                if (solveState == SolveState.FIND)
                {
                    Cell current;
                    if (!OpenSet.GetMin(out current))
                    {
                        tick_timer.Stop();
                        return;
                    }
                    current.Open = State.CLOSED;
                    OpenSet.DeleteMin();

                    List <Cell> neighbours = getNeighbours(current.i, current.k);
                    neighbours.ForEach(n => {
                        int newGScore = current.gScore + Cell.d(current, n);
                        if (newGScore < n.gScore)
                        {
                            n.gScore = newGScore;
                            n.fScore = n.hScore + n.gScore;
                            n.parent = current;
                            if (n.Open == State.UNDEFINED)
                            {
                                n.Open = State.OPENED;
                                OpenSet.Add(n);
                            }
                        }
                    });


                    if (current == target)
                    {
                        solveState = SolveState.TRACE;
                        trace      = target;
                        trace.Open = State.PATH;
                    }
                }
                else
                {
                    if (trace.parent != null)
                    {
                        trace.parent.Open = State.PATH;
                        trace             = trace.parent;
                    }
                    else
                    {
                        tick_timer.Stop();
                    }
                }
            }
            this.Refresh();
        }
コード例 #24
0
        public async Task <IActionResult> Solve(string id,
                                                CancellationToken cancellationToken)
        {
            SolveState state = await _solveStateStore.GetAsync(id,
                                                               cancellationToken);

            return(new JsonResult(new
            {
                BoardsExaminedCount = state.BoardsExaminedCount,
                Solution = state.Solution?.ToHandInputString()
            }));
        }
コード例 #25
0
 public void RemoveLastAction()
 {
     state = SolveState.Solving;
     if (pathsOfColors.Last().path.Count > 0)
     {
         pathsOfColors.Last().RemoveLast();
     }
     else if (pathsOfColors.Count > 1)
     {
         pathsOfColors.Remove(pathsOfColors.Last());
         pathsOfColors.Last().RemoveLast();
     }
 }
コード例 #26
0
ファイル: SudokuSolver.cs プロジェクト: LucieMoulin/Sudoku
        /// <summary>
        /// Valide récursivement les petits chiffres seuls
        /// </summary>
        /// <returns></returns>
        private SolveState TreatUniqueSmallNumbers()
        {
            SolveState finalState = SolveState.Solving;

            foreach (SudokuCell cell in sudoku.Grid)
            {
                SolveState cellState = SolveState.Solving;

                //Si la case est modifiable
                if (!cell.IsFixed && cell.Number == 0)
                {
                    //Si il y a un seul petit chiffre dans la case, placement du chiffre
                    if (cell.SmallNumbers.Count == 1)
                    {
                        cell.EditNumber(cell.SmallNumbers[0]);

                        UpdateObservers();

                        if (sudoku.IsCompleted())
                        {
                            //Sudoku terminé
                            return(SolveState.Solved);
                        }
                        else
                        {
                            RemoveSmallNumbers(cell.Y, cell.X, cell.Number);

                            cellState = SolveState.FoundNumber;
                        }
                    }
                }

                //Si la suite n'a rien trouvé et que rien a été trouvé cette fois, retour que rien a été trouvé
                switch (cellState)
                {
                case SolveState.FoundNumber:
                case SolveState.Solved:
                    finalState = cellState;
                    break;
                }
            }

            if (finalState == SolveState.Solving)
            {
                return(SolveState.UnableToSolve);
            }
            else
            {
                return(finalState);
            }
        }
コード例 #27
0
        public override void SetObjectData()
        {
            base.SetObjectData();
            int persistedClassVersion = (int)info.GetValue("ClassPersistenceVersionSolvable", typeof(int));

            if (persistedClassVersion == 1)
            {
                this.name         = (string)info.GetValue("Name", typeof(string));
                this.solveState   = (SolveState)info.GetValue("SolveState", typeof(SolveState));
                this.varList      = info.GetValue("VarList", typeof(ArrayList)) as ArrayList;
                this.unitOpSystem = (UnitOperationSystem)info.GetValue("UnitOpSystem", typeof(UnitOperationSystem));
            }
            RecallInitialization();
        }
コード例 #28
0
        public SolvingGrid(int[,] grid)
        {
            this.grid = grid;
            List <Point> starts = new List <Point>();

            endNodes = new List <Point>();
            List <int> colorsList = new List <int>();

            // find the start nodes, colors, and end nodes
            for (int y = 0; y < grid.GetLength(0); y++)
            {
                for (int x = 0; x < grid.GetLength(1); x++)
                {
                    if (grid[y, x] != -1 && !colorsList.Contains(grid[y, x]))
                    {
                        starts.Add(new Point(x, y));
                        colorsList.Add(grid[y, x]);
                    }
                    else if (colorsList.Contains(grid[y, x]))
                    {
                        endNodes.Add(new Point(x, y));
                    }
                }
            }
            startNodes    = starts.ToArray();
            state         = SolveState.Solving;
            colors        = colorsList.ToArray();
            pathsOfColors = new List <Path>();
            pathsOfColors.Add(new Path(startNodes[0], colors[0]));

            // sort endNodes to correspond correctly with startNodes
            List <Point> endNodesSorted = new List <Point>();

            for (int i = 0; i < startNodes.Length; i++)
            {
                for (int j = 0; j < endNodes.Count; j++)
                {
                    if (grid[endNodes[j].Y, endNodes[j].X] == colors[i])
                    {
                        endNodesSorted.Add(endNodes[j]);
                        j = endNodes.Count;
                    }
                }
            }
            endNodes = endNodesSorted;
        }
コード例 #29
0
 //Erase all the calculated values in each solvable
 internal virtual void EraseCalculatedProcVarValues()
 {
     foreach (ProcessVar var in varList)
     {
         if (var.IsCalculated)
         {
             EraseOldValue(var);
             var.State = VarState.Specified;
         }
         else if (var.IsAlwaysCalculated)
         {
             EraseOldValue(var);
         }
     }
     solveState      = SolveState.NotSolved;
     isBeingExecuted = false;
     OnSolveComplete(solveState);
 }
コード例 #30
0
        public static SolveState OnPreviousMove(SolveState state)
        {
            var prevMoveIndex = state.CurrentMoveIndex - 1;

            bool isIndexValid = prevMoveIndex >= 0;

            if (!isIndexValid)
            {
                return(state);
            }

            var move = state.Moves[prevMoveIndex];

            return(state with
            {
                CurrentMove = move,
                CurrentMoveIndex = prevMoveIndex,
                Board = move.Board
            });
        }
コード例 #31
0
ファイル: Board.cs プロジェクト: Tilps/Stash
        /// <summary>
        /// Performs a single 'lookahead' logic attempt.
        /// </summary>
        /// <param name="ys">
        /// Y coordinates to try.
        /// </param>
        /// <param name="xs">
        /// X coordinates to try.
        /// </param>
        /// <param name="values">
        /// Values to try in each location.
        /// </param>
        /// <returns></returns>
        private SolveState PassPartLookaheadLogic(List<int> ys, List<int> xs, List<int> values, int lookahead)
        {
            Board[] boards = new Board[ys.Count];
            SolveState[] results = new SolveState[ys.Count];
            SolveState result = SolveState.MultipleSolutions;
            for (int i = 0; i < boards.Length; i++)
            {
                boards[i] = this.Clone();
                boards[i].maxLookahead = lookahead - 1;
                boards[i].scoring = 0;
                boards[i].Set(xs[i], ys[i], values[i]+1);
                if (scoring == 0 || lookahead > 1)
                {
                    results[i] = boards[i].SolveProper();
                }
                else
                {
                    for (int j = 0; j < scoring - 1; j++)
                    {
                        results[i] = boards[i].PassZeroSlow();
                        if (results[i] != SolveState.Progressing)
                            break;
                    }
                }
            }
            bool allUnsolvable = true;
            for (int i = 0; i < results.Length; i++)
            {
                if (results[i] != SolveState.Unsolvable)
                    allUnsolvable = false;
                else
                {
                    if (!useEliminations)
                    {
                        results[i] = SolveState.MultipleSolutions;
                        allUnsolvable = false;
                    }
                    else
                    {
                        if (possibles[xs[i], ys[i], values[i]])
                        {
                            possibles[xs[i], ys[i], values[i]] = false;
                            result = SolveState.Progressing;
                        }
                    }
                }
            }
            if (allUnsolvable)
                return SolveState.Unsolvable;
            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < width; j++)
                {
                    if (cells[i, j] == 0)
                    {
                        for (int k = 0; k < width; k++)
                        {
                            if (possibles[i, j, k])
                            {
                                bool allFalse = true;
                                for (int b = 0; b < boards.Length; b++)
                                {
                                    if (results[b] != SolveState.Unsolvable)
                                    {
                                        if (boards[b].possibles[i, j, k])
                                            allFalse = false;
                                    }
                                }
                                if (allFalse)
                                {
                                    if (scoring != 0)
                                    {
                                        if (useLogging)
                                        {
                                            for (int a = 0; a < xs.Count; a++)
                                            {
                                                log.AppendFormat("({0},{1} {2}) ", xs[a], ys[a], values[a] + 1);
                                            }
                                            if (lookahead <=1)
                                                log.AppendFormat("Eliminated {0},{1} {2} in {3} steps\n", i, j, k + 1, scoring - 1);
                                            else
                                                log.AppendFormat("Eliminated {0},{1} {2} at {3} branches\n", i, j, k + 1, lookahead);
                                            if (scoring > 1)
                                            {
                                                for (int a = 0; a < xs.Count; a++)
                                                {
                                                    List<int> peggedxs = new List<int>();
                                                    peggedxs.Add(xs[a]);
                                                    List<int> peggedys = new List<int>();
                                                    peggedys.Add(ys[a]);
                                                    List<int> peggedvs = new List<int>();
                                                    peggedvs.Add(values[a]+1);
                                                    List<int> peggedwhen = new List<int>();
                                                    peggedwhen.Add(0);
                                                    for (int pegged = 0; pegged < scoring - 1; pegged++)
                                                    {
                                                        Board tb = this.Clone();
                                                        tb.Apply(peggedxs, peggedys, peggedvs);
                                                        tb.PassZeroSlow();
                                                        List<int> possiblexs = new List<int>(tb.lastxs);
                                                        List<int> possibleys = new List<int>(tb.lastys);
                                                        List<int> possiblevs = new List<int>(tb.lastvalues);
                                                        List<int> bestxs = new List<int>(possiblexs);
                                                        List<int> bestys = new List<int>(possibleys);
                                                        List<int> bestvs = new List<int>(possiblevs);
                                                        for (int trial = possiblexs.Count - 1; trial >= 0; trial--)
                                                        {
                                                            tb = this.Clone();
                                                            tb.Apply(peggedxs, peggedys, peggedvs);
                                                            possiblexs.RemoveAt(trial);
                                                            possibleys.RemoveAt(trial);
                                                            possiblevs.RemoveAt(trial);
                                                            tb.Apply(possiblexs, possibleys, possiblevs);
                                                            for (int nextp = pegged + 1; nextp < scoring - 1; nextp++)
                                                            {
                                                                if (tb.PassZeroSlow() != SolveState.Progressing)
                                                                    break;
                                                            }
                                                            if (tb.possibles[i, j, k] != false)
                                                            {
                                                                possiblexs = new List<int>(bestxs);
                                                                possibleys = new List<int>(bestys);
                                                                possiblevs = new List<int>(bestvs);
                                                            }
                                                            else
                                                            {
                                                                bestxs = new List<int>(possiblexs);
                                                                bestys = new List<int>(possibleys);
                                                                bestvs = new List<int>(possiblevs);
                                                            }
                                                        }
                                                        peggedxs.AddRange(bestxs);
                                                        peggedys.AddRange(bestys);
                                                        peggedvs.AddRange(bestvs);
                                                        for (int index = 0; index < bestvs.Count; index++)
                                                        {
                                                            peggedwhen.Add(pegged + 1);
                                                        }
                                                    }
                                                    log.AppendFormat("Trial ({0},{1} {2}):\n", xs[a], ys[a], values[a] + 1);
                                                    string[] splits = boards[a].Log.Split('\n');
                                                    for (int b = 0; b < peggedxs.Count; b++)
                                                    {
                                                        log.AppendFormat(" {3}: {0}, {1} {2}\n", peggedxs[b], peggedys[b], peggedvs[b], peggedwhen[b]);
                                                    }
                                                }

                                            }
                                        }
                                        possibles[i, j, k] = false;
                                        return SolveState.Progressing;
                                    }
                                    possibles[i, j, k] = false;
                                    result = SolveState.Progressing;
                                }
                            }
                        }
                    }
                }
            }
            return result;
        }