private List <RubickColorMatrix> GetBestNeighbors(RubickColorMatrix _node) { List <RubickColorMatrix> neighbors = new List <RubickColorMatrix>(); int min = int.MaxValue; RubickColorMatrix minNeightbor = null; var moves = System.Enum.GetValues(typeof(RubickMovementTypes)); for (int i = 0; i < moves.Length; i++) { RubickMovementTypes val = (RubickMovementTypes)moves.GetValue(i); if (val != RubickMovementTypes.None) { RubickColorMatrix clone = (RubickColorMatrix)_node.Clone(); clone.Transform(val); int cost = clone.HeuristicCostEstimate(); if (cost < min) { min = cost; minNeightbor = clone; } } } if (min == _node.HeuristicCostEstimate()) { UnityEngine.Debug.Log("Duh"); } neighbors.Add(minNeightbor); return(neighbors); }
public int getHeuristicValue(object state) { RubickColorMatrix node = (RubickColorMatrix)state; return(node.HeuristicCostEstimate()); }
private int HeuristicCostEstimate(RubickColorMatrix _node) { return(_node.HeuristicCostEstimate()); }