From 6df92902acb9c1eb96337c0ad6380140a476f4f0 Mon Sep 17 00:00:00 2001 From: Jamal Millner II Date: Wed, 16 Oct 2024 08:11:39 -0400 Subject: [PATCH] Tree Array bug is fixed and Multi array solve needs to add last command before sending to master array --- PlayerScript.gd | 49 +++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/PlayerScript.gd b/PlayerScript.gd index 51eb1da..50187b6 100644 --- a/PlayerScript.gd +++ b/PlayerScript.gd @@ -11,7 +11,8 @@ var Intersections = [[]] var Intersections_Copy = [] var Distance_From_Intersection = 0 -var Tree_Array = [99] +var Tree_Array = [99]#[99] +var Tree_Array_SetStart = 99 var Options = [] var BackTrack_Array = [] var Traveled = false @@ -53,6 +54,7 @@ var Move_Check7 = 0 var Move_Check4 = 0 var Move_Check9 = 0 var Move_Check10 = 0 +var Move_Check1 = 0 var Cicling = false var CircleIntsMax = 0 var CircleInts = 0 @@ -77,7 +79,7 @@ var FirstGoTo = [] var AllSetsToGoal = [] var TargetsArray = [] var Goal = false - +#TODO Fix TREE ARRAY BUG func _input(event): #if Current_Position != TargetCord: if event.is_action_pressed("ui_left"): @@ -98,9 +100,10 @@ func _input(event): AutoBacktrack = false elif event.is_action_pressed("ui_accept"): AutoSolve() - + #print(Tree_Array) + func _process(delta): - #FoundGoal() + FoundGoal() AllObjectsFound() CallableRaycastData() Mark(Prev_dir) @@ -119,7 +122,7 @@ func _process(delta): IntersectionDumping() CordsDumping() FinishCircling() - print(Tree_Array) + #if Detail_Dict.Type == "3 Way Intersection": # print(Individual_Steps) #print(Detail_Dict.Type) @@ -143,18 +146,20 @@ func _process(delta): func FoundGoal(): - if TargetCord.find(Current_Position) != -1 and TargetsArray.find(Current_Position) == -1: + if TargetCord.find(Cords[-1]) != -1 and TargetsArray.find(Cords[-1]) == -1: Goal = true print("GOAL!!!!!!!!!!!") + print(Current_Position) if Done != move: print("Circling is: ", Cicling) print("Current Pos: ", Current_Position) print(Intersections) - Mark(Prev_dir) - TrackIntersections() - BackToStart() + #Mark(Prev_dir) + #TrackIntersections() + #BackToStart() TargetsArray.push_back(Current_Position) AllSetsToGoal.push_back(Individual_Steps) + print(BackTrack_Array) AllSetsToGoal.push_back(" BUFFER ") var TargetCopy = TargetsArray.duplicate(true) var SetsCopy = AllSetsToGoal.duplicate(true) @@ -163,10 +168,13 @@ func FoundGoal(): print("Here is the Set to go to young bull: ",AllSetsToGoal) Done = move + func AllObjectsFound(): - if Tree_Array.is_empty() and IntersectionDump.size() > 0: - print("Solved") - return true + if Tree_Array_SetStart != Tree_Array[0]: + if Move_Check1 != move: + print("We Done!!!!!!!!!!!!!!!!!") + print("This is all the sets to goal gango", AllSetsToGoal) + Move_Check1 = move func Mark(Prev_Direction): @@ -466,16 +474,17 @@ func Intersection_Tree(): Move_Check2 = move func CheckForTreeDeadEnds(): - if Tree_Array[-1] <= 0: - Tree_Array[- 1] -= 1 - print(Individual_Steps[0]) - if Tree_Array.size() > 0: + + if Tree_Array.size() > 0: + if Tree_Array[-1] <= 0: + Tree_Array.pop_back() + Tree_Array[-1] -= 1 + print(Tree_Array) GoBack(Individual_Steps[0]) Individual_Steps.pop_front() - Tree_Array.pop_back() - print(Tree_Array) - else: - pass + + else: + pass func GiveOrder(): if Cicling == false: