static void MakeAllSteps(Match3Map actualMap, Point startPoint) { for (int x = startPoint.x; x < actualMap.Width - 1; x += Constants.checkingStep) { for (int y = startPoint.y; y < actualMap.Height; y += Constants.checkingStep) { actualMap.SwapCells(new Point(x, y), new Point(x + 1, y)); } } }
public bool MakeStep(Point cell0, Point cell1) { map.SwapCells(cell0, cell1); if ( (cell0 - cell1).Magnitude() > 1 || UpdateMapState() == 0 ) { currentStepIndex++; map.SwapCells(cell0, cell1); return(false); } else { return(true); } }
public static void MoveDownAllPossibleCells(Match3Map actualMap) { int swaps = 0; do { swaps = 0; for (int j = 0; j < actualMap.Height - 1; j++) { for (int i = 0; i < actualMap.Width; i++) { if (actualMap[i, j] == null && actualMap[i, j + 1] != null) { actualMap.SwapCells(new Point(i, j), new Point(i, j + 1)); swaps++; } } } }while (swaps != 0); }
static List <Point[]> GetHintsByStep(Match3Map actualMap, Point startPoint) { var result = new List <Point[]>(); for (int x = startPoint.x; x < actualMap.Width - 1; x += Constants.checkingStep) { for (int y = startPoint.y; y < actualMap.Height; y += Constants.checkingStep) { var mapCopy = new Match3Map(actualMap); mapCopy.SwapCells(new Point(x, y), new Point(x + 1, y)); if (Match3BangController.GetAllBangLines(mapCopy).Count > 0) { result.Add(new Point[] { new Point(x, y), new Point(x + 1, y) }); } } } return(result); }