private IEnumerable <LineSeriesBlock> FindHorizontalMass(StoredBoardState.DrMarioScoringRuleData data, StoredBoardState state, int pRow, int pCol, LineSeriesBlock.CombiningTypes MatchingIndex, List <LineSeriesBlock> InConsiderables) { int CurrR = pRow, CurrC = pCol; //look to the left while (state.State[CurrR][CurrC] is LineSeriesBlock lsb && lsb.CombiningIndex == MatchingIndex && CurrC > 0) { CurrC--; } int FirstC = CurrC; int CheckC = FirstC; if (CurrC != FirstC) { //we have a horizontal group. let's grab the blocks. while (state.State[CurrR][CheckC] is LineSeriesBlock lsb && lsb.CombiningIndex == MatchingIndex && CurrC < state.ColCount - 1) { if (InConsiderables.Contains(lsb)) { break; } CheckC++; yield return(lsb); } } }
private IEnumerable <LineSeriesBlock> FindVerticalMass(StoredBoardState.DrMarioScoringRuleData data, StoredBoardState state, int pRow, int pCol, LineSeriesBlock.CombiningTypes MatchingIndex, List <LineSeriesBlock> InConsiderables) { int CurrR = pRow, CurrC = pCol; //look above. while (state.State[CurrR][CurrC] is LineSeriesBlock lsb && lsb.CombiningIndex == MatchingIndex && CurrR > 0) { CurrR--; } int FirstR = CurrR; int CheckR = FirstR; if (CurrR != FirstR) { //we have a vertical group. Lets see what blocks. So from the starting point, //check each block until air, or until we see a different coloured block OR we reach the other side of the stage. while (state.State[CheckR][CurrC] is LineSeriesBlock lsb && lsb.CombiningIndex == MatchingIndex && CurrC < state.ColCount - 1) { if (InConsiderables.Contains(lsb)) { break; } CheckR++; yield return(lsb); } } }