private static void _add(Dictionary <int, List <Actions.ActionChain> > dest, Actions.ActionChain src) { int cost = src.CumulativeMoveCost(); if (dest.TryGetValue(cost, out var cache)) { cache.Add(src); } else { dest.Add(cost, new List <Actions.ActionChain> { src }); } }