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

This commit is contained in:
2024-11-08 08:12:18 -05:00
parent bae5ebd549
commit 3df79803fe

View File

@@ -85,6 +85,7 @@ var InstancesDict = {}
var Keys = [] var Keys = []
var RouteCounter = 0 var RouteCounter = 0
var SendToRobo = [] var SendToRobo = []
var RetraveledArray = []
func _input(event): func _input(event):
#if Current_Position != TargetCord: #if Current_Position != TargetCord:
@@ -185,36 +186,57 @@ func AllObjectsFound():
#print(InstancesDict) #print(InstancesDict)
MakeDescision(0) MakeDescision(0)
MakeDescision(1)
MakeDescision(2)
Move_Check1 = move Move_Check1 = move
func MakeDescision(marker): func MakeDescision(marker):
var BestFirst = [] var BestFirst = []
var Arrays = [] var Arrays = []
var Temp = []
for n in AllSetsToGoal: for n in AllSetsToGoal:
if Keys.find(AllSetsToGoal.find(n)) != -1 or RouteCounter == 0: if Keys.find(AllSetsToGoal.find(n)) != -1 or RouteCounter == 0:
Arrays.push_back(n[marker]) Arrays.push_back(n[marker])
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() print()
BestFirst = SmallInstances(Arrays) BestFirst = SmallInstances(Arrays)
print("BestFirst is equal to: ", BestFirst )
var Theindex = BestFirst.values().find(BestFirst.values().max()) var Theindex = BestFirst.values().find(BestFirst.values().max())
var Decision = BestFirst.keys()[Theindex] var Decision = BestFirst.keys()[Theindex]
RetraveledArray.push_back(Decision)
print("This is the Index: ", Theindex, " and this is the decision: ", Decision)
if RouteCounter == 0: if RouteCounter == 0:
for n in AllSetsToGoal: for n in AllSetsToGoal:
if n.find(BestFirst.keys()[Theindex]) != -1: if n.find(BestFirst.keys()[Theindex]) != -1:
Keys.push_back(AllSetsToGoal.find(n)) Keys.push_back(AllSetsToGoal.find(n))
print("Keys!!!: ",Keys)
#if RouteCounter == 0 or #If what im modifiying is in AllsetsToGo[Keys] #if RouteCounter == 0 or #If what im modifiying is in AllsetsToGo[Keys]
print(CommonsSort(AllSetsToGoal)) #print(Temp)
print(AllSetsToGoal) #print(CommonsSort)
var Temp = []
for n in AllSetsToGoal.size():
Temp.append_array(AllSetsToGoal[n])
print(Temp)
print(CommonsSort)
if Keys.size() == 1:
print("Auto From Here")
else:
RGoBack(Decision)
#var Temp = [] #var Temp = []
#CommonsSort(Temp) #CommonsSort(Temp)
#if InstancesDict.get(Decision) <= 1: #if InstancesDict.get(Decision) <= 1:
@@ -229,7 +251,7 @@ func MakeDescision(marker):
# print("THIS ISNT COMMON ") # print("THIS ISNT COMMON ")
# CommonsSort(AllSetsToGoal) # CommonsSort(AllSetsToGoal)
RGoBack(Decision)