Example #1
0
        public static int WillCauseMatchCount(IRuntimeJewel[,] jewels, IRuntimeJewel swap1, IRuntimeJewel swap2, List <JewelID> prefJewels = null)
        {
            jewels[(int)swap1.Pos.x, (int)swap1.Pos.y] = swap2;
            jewels[(int)swap2.Pos.x, (int)swap2.Pos.y] = swap1;
            int MatchCount = 0;
            List <IRuntimeJewel> foundMatches = FindMatchesUtil.FindMatches(jewels);

            if (prefJewels != null)
            {
                List <JewelID> matchesPref = new List <JewelID>();
                foreach (IRuntimeJewel jwl in foundMatches)
                {
                    if (prefJewels.Contains(jwl.Data.JewelID) && !matchesPref.Contains(jwl.Data.JewelID))
                    {
                        matchesPref.Add(jwl.Data.JewelID);
                    }
                }
                MatchCount = foundMatches.Count + matchesPref.Count;
            }
            else
            {
                MatchCount = foundMatches.Count;
            }
            jewels[(int)swap1.Pos.x, (int)swap1.Pos.y] = swap1;
            jewels[(int)swap2.Pos.x, (int)swap2.Pos.y] = swap2;
            return(MatchCount);
        }
Example #2
0
        public static bool WillCauseMatch(IRuntimeJewel[,] jewels, IRuntimeJewel swap1, IRuntimeJewel swap2)
        {
            jewels[(int)swap1.Pos.x, (int)swap1.Pos.y] = swap2;
            jewels[(int)swap2.Pos.x, (int)swap2.Pos.y] = swap1;
            bool foundMatches = FindMatchesUtil.FindMatches(jewels).Count > 0;

            jewels[(int)swap1.Pos.x, (int)swap1.Pos.y] = swap1;
            jewels[(int)swap2.Pos.x, (int)swap2.Pos.y] = swap2;
            return(foundMatches);
        }