public bool Test(bool a_all)
        {
            if (m_after == null)
            {
                return(false);
            }
            if (m_solution == null)
            {
                return(false);
            }

            SudokuSolutionNode node = SudokuSolutionNode.CreateRoot(m_before);

            if (a_all)
            {
                node.StepAll();
            }
            else
            {
                node.Step(m_solution.Type);
            }

            SudokuSolutionNode solved_node = node.Nodes.FirstOrDefault(n => n.Solution.Equals(m_solution));

            if (solved_node == null)
            {
                return(false);
            }

            return(m_after.Equals(solved_node.NextBoard));
        }
示例#2
0
        public override bool Equals(object a_obj)
        {
            if (a_obj == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, a_obj))
            {
                return(true);
            }
            SudokuSolutionNode node = a_obj as SudokuSolutionNode;

            if (node == null)
            {
                return(false);
            }

            if (m_state != node.m_state)
            {
                return(false);
            }

            if (!m_board.Equals(node.m_board))
            {
                return(false);
            }

            if ((m_solution == null) && (node.m_solution == null))
            {
                return(true);
            }

            if ((m_solution == null) ^ (node.m_solution == null))
            {
                return(false);
            }

            if (m_solution.Equals(node.m_solution))
            {
                return(true);
            }

            return(false);
        }
        public override bool Equals(object a_obj)
        {
            if (a_obj == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, a_obj))
            {
                return(true);
            }
            SudokuIntermediateSolution intermediate_solution = a_obj as SudokuIntermediateSolution;

            if (intermediate_solution == null)
            {
                return(false);
            }

            return(m_before.Equals(intermediate_solution.m_before) &&
                   m_after.Equals(intermediate_solution.m_after) &&
                   m_solution.Equals(intermediate_solution.m_solution));
        }