static bool IsAnyHorizontalStepsEffective(Match3Map actualMap) { for (int i = 0; i < Constants.checkingStep; i++) { for (int j = 0; j < Constants.checkingStep; j++) { var mapCopy = new Match3Map(actualMap); MakeAllSteps(mapCopy, new Point(i, j)); var bangLines = Match3BangController.GetAllBangLines(mapCopy); if (bangLines.Count > 0) { return(true); } } } return(false); }
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); }
private int UpdateMapState() { var result = 0; var isCurrentMapValid = true; do { if (!isCurrentMapValid) { Match3MapManager.ResetMap(map, cellTypesCount); } var previosResult = 0; do { previosResult = result; var bangLines = Match3BangController.GetAllBangLines(map); if (bangLines.Count == 0) { continue; } var comboBangPoints = Match3BangController.GetComboBangItems(map, bangLines); var currentStepScore = ScoreManager.GetScore(bangLines, comboBangPoints); var cellsForDestroy = new List <Point>(); currentStepIndex++; Match3MapManager.DestroyStepCells(map, bangLines, comboBangPoints); result += currentStepScore; ActualScore += currentStepScore; Match3MapManager.MoveDownAllPossibleCells(map); Match3MapManager.FillAllEmptyCells(map, cellTypesCount); }while (previosResult != result); isCurrentMapValid = MapStateManager.IsMapValid(map); }while (!isCurrentMapValid); return(result); }
static List <Point[]> GetHorizontalHints(Match3Map actualMap) { var result = new List <Point[]>(); for (int i = 0; i < Constants.checkingStep; i++) { for (int j = 0; j < Constants.checkingStep; j++) { var mapCopy = new Match3Map(actualMap); MakeAllSteps(mapCopy, new Point(i, j)); var bangLines = Match3BangController.GetAllBangLines(mapCopy); if (bangLines.Count > 0) { result.AddRange(GetHintsByStep(actualMap, new Point(i, j))); } } } return(result); }