From 3df79803fe9124a9632dcefd56244691eaa90253 Mon Sep 17 00:00:00 2001 From: Jamal Millner II Date: Fri, 8 Nov 2024 08:12:18 -0500 Subject: [PATCH] Doing a rework finally i know how im tackling reroute. It is now in a form of splits instead of every single path aquired which is faster and a little easier for me to comprehend. Going good i left a couple blank spots that need to be fixed like finishing a split and jumping back to the trunk but otherwise going strong. I did implement split detection today and should be a big step up from the dictionary method --- PlayerScript.gd | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/PlayerScript.gd b/PlayerScript.gd index 6d33b9a..52c7704 100644 --- a/PlayerScript.gd +++ b/PlayerScript.gd @@ -85,6 +85,7 @@ var InstancesDict = {} var Keys = [] var RouteCounter = 0 var SendToRobo = [] +var RetraveledArray = [] func _input(event): #if Current_Position != TargetCord: @@ -185,36 +186,57 @@ func AllObjectsFound(): #print(InstancesDict) MakeDescision(0) + MakeDescision(1) + MakeDescision(2) Move_Check1 = move func MakeDescision(marker): var BestFirst = [] var Arrays = [] + var Temp = [] for n in AllSetsToGoal: if Keys.find(AllSetsToGoal.find(n)) != -1 or RouteCounter == 0: Arrays.push_back(n[marker]) - print() - + print("Part of Key array") + print(Keys) + print("The n value is: ", n) + print("THE COMMON ELEMENTS ARE: ", SmallInstances(Arrays)) + Temp = SmallInstances(Arrays) + if Temp.values()[0] != Keys.size(): + print("SPLIT!!!!!!!!!!!!!!!!!!!") + print("FInish the path you are on") + + + else: #INSTRUCTIONS FOR VALS NOT IN KEY + pass + + print() + print("Arrays is: ", Arrays) + print() + BestFirst = SmallInstances(Arrays) + print("BestFirst is equal to: ", BestFirst ) var Theindex = BestFirst.values().find(BestFirst.values().max()) var Decision = BestFirst.keys()[Theindex] + RetraveledArray.push_back(Decision) + print("This is the Index: ", Theindex, " and this is the decision: ", Decision) + if RouteCounter == 0: for n in AllSetsToGoal: if n.find(BestFirst.keys()[Theindex]) != -1: Keys.push_back(AllSetsToGoal.find(n)) + print("Keys!!!: ",Keys) #if RouteCounter == 0 or #If what im modifiying is in AllsetsToGo[Keys] - print(CommonsSort(AllSetsToGoal)) - print(AllSetsToGoal) - var Temp = [] - for n in AllSetsToGoal.size(): - Temp.append_array(AllSetsToGoal[n]) - print(Temp) - print(CommonsSort) - + #print(Temp) + #print(CommonsSort) + if Keys.size() == 1: + print("Auto From Here") + else: + RGoBack(Decision) #var Temp = [] #CommonsSort(Temp) #if InstancesDict.get(Decision) <= 1: @@ -229,7 +251,7 @@ func MakeDescision(marker): # print("THIS ISNT COMMON ") # CommonsSort(AllSetsToGoal) - RGoBack(Decision) +