diff --git a/PlayerScript.gd b/PlayerScript.gd index 5e94f61..69e8c5e 100644 --- a/PlayerScript.gd +++ b/PlayerScript.gd @@ -48,6 +48,7 @@ var move_check3 = 0 var move_check5 = 0 var Move_Check6 = 0 var Move_Check7 = 0 +var Move_Check4 = 0 var Move_Check9 = 0 var Cicling = false var CircleIntsMax = 0 @@ -178,11 +179,6 @@ func Circling(): if Been_There_Array.size() > 3: if move_check5 != move: if Intersections.find(Current_Position) != Intersections.size()-1 and Intersections.find(Current_Position) != -1 and Been_There_Array[-2] == false and Been_There_Array[-3] == false: - # var holder = [] - # for n in (move - BackTrack_Array[-1]): - # holder.push_back(LogDump[n]) - #holder.push_front(Prev_dir_Opp) - #print(holder) print("Circling") Cicling = true #ndividual_Steps.push_front(holder) @@ -194,9 +190,10 @@ func Circling(): for n in CircleIntsMax: Individual_Steps.pop_front() GoBack(Individual_Steps[0]) + if CircleInts != 0: print("Go back to circle part :(") - #FirstCirclePart() + FirstCirclePart() move_check5 = move func HowManyIntsInCircle(): @@ -210,31 +207,13 @@ func HowManyIntsInCircle(): print(CircleInts) func FirstCirclePart(): - var count = CircleInts + var holder = [] + for n in (move - BackTrack_Array[-1] + 1): + #holder.push_back(LogDump[n]) + holder.push_front(Prev_dir_Opp) + print(holder) + GoBack(holder) - if count == 0 and Current_Position == Intersections_from_root[0]: - Cicling = false - Intersection_Tree() - Ordered_Commands_Backward.clear() - print("Ignoreeeeeee") - for takeout in CircleInts + 1: - Individual_Steps.pop_front() - Tree_Array.pop_back() - print("Goin back") - print(Individual_Steps) - GoBack(Individual_Steps[0]) - CircleCompleted = true - #** Returning if it needs more work or not - return false - - elif count != 0 and Current_Position == Intersections_from_root[0]: - GoBack(Individual_Steps[0]) - Individual_Steps.pop_front() - print("Number Of Ints: ", CircleInts) - print(Individual_Steps) - #** Returning if it needs more work or not - return true - func CircleRootsAndInts(): if Cicling == true: if Detail_Dict.Type != "Plain Path": @@ -242,12 +221,11 @@ func CircleRootsAndInts(): Intersections_from_root.push_back(Current_Position) var Duplicate = Intersections_from_root.duplicate(true) Intersections_from_root = Duplicate + print(Intersections_from_root) func DeadEndCircles(): if Cicling == true: if Detail_Dict.Type == "Dead End": - if AutoBacktrack == true: - CircleIntSubtractor() return true else: return false @@ -256,21 +234,20 @@ func SolvinCircleDeadEnds(): if CircleManualDistance() != null: for n in CircleManualDistance(): GoBack(LogDump[n]) - -func CircleComplete(): - if CircleCompleted == true: - if Detail_Dict.Type != "Plain Path" and Detail_Dict.Been_There == false: - Individual_Steps.push_front(GiveOrder()) - print("Circle Complete") - print(Individual_Steps) - print(Tree_Array) - CircleCompleted = false - else: - pass + #print(Individual_Steps[0]) + CircleInts -= 1 + GoBack(Individual_Steps[0]) + print(CircleInts) + +func CircleManualDistance(): + if DeadEndCircles() == true and Intersections_from_root.size() >= 2: + var Starting_Pos = Intersections_from_root[-2] + var Ending_Pos = Intersections_from_root[-1] + + var x = abs(Starting_Pos[0] - Ending_Pos[0]) + var y = abs(Starting_Pos[1] - Ending_Pos[1]) + return x+y -func CircleIntSubtractor(): - CircleInts -= 1 - print(CircleInts) func Intersection_Tree(): if Cicling == false: @@ -304,14 +281,6 @@ func CheckForTreeDeadEnds(): else: pass -func CircleManualDistance(): - if DeadEndCircles() == true and Intersections_from_root.size() >= 2: - var Starting_Pos = Intersections_from_root[-2] - var Ending_Pos = Intersections_from_root[-1] - - var x = abs(Starting_Pos[0] - Ending_Pos[0]) - var y = abs(Starting_Pos[1] - Ending_Pos[1]) - return x+y func GiveOrder(): Ordered_Commands_Backward.erase("")