Exemplo n.º 1
0
        static private Move BestAbsorbedBy(Component component, Combinable combinable)
        {
            PatchPattern unification = component.PatchPattern().UnifyOrNull(combinable.PatchPattern());

            if (unification != null)
            {
                Move bestMove = new MergeInPatch(component, combinable, unification);
                return(bestMove);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        static private Move BestRightLeftOrNull(Component component, Combinable combinable, PatchPattern main, PatchPattern other)
        {
            int lengthOfShorter = Math.Min(main.CoreLength, other.CoreLength);


            for (int overlap = lengthOfShorter - 1; overlap > 0; --overlap)
            {
                PatchPattern unification = other.UnifyOnRightOrNull(overlap, main);
                if (unification != null)
                {
                    Move aMove = new MergeInPatch(component, combinable, unification);
                    return(aMove);
                }
            }

            return(null);
        }