Depth search improved with array instead of individual vars. I need to fix trunk system its not working :(

This commit is contained in:
2024-10-29 08:14:15 -04:00
parent 6b05323ded
commit d550fca787

View File

@@ -102,6 +102,7 @@ func _input(event):
AutoBacktrack = false
elif event.is_action_pressed("ui_accept"):
AutoSolve()
#print(Tree_Array)
# print(Current_Position)
func _process(delta):
@@ -182,16 +183,18 @@ func FoundGoal():
func AllObjectsFound():
if Tree_Array_SetStart != Tree_Array[0]:
var CurrentInstructionSet = []
Trunk = CommonElements(AllSetsToGoal[0], AllSetsToGoal[1], AllSetsToGoal[2])
print("This is the Trunk ", Trunk)
if Move_Check1 != move:
print("We Done!!!!!!!!!!!!!!!!!")
print()
for n in AllSetsToGoal.size():
var placeHolder = []
placeHolder = AllSetsToGoal[n]
placeHolder.slice(Trunk[-1])
print(n ," set is equal to : ", placeHolder )
#placeHolder = AllSetsToGoal[n]
#placeHolder.slice(placeHolder.find(Trunk[-1]))
#Trunk = CommonElements(AllSetsToGoal[0], AllSetsToGoal[1], AllSetsToGoal[2])
#print("This is the Trunk ", Trunk)
var Arrays = [['apple', 'orange', 'banana', 'pear', 'fish', 'pancake', 'taco', 'pizza'],['banana', 'pizza', 'fish', 'apple'],['taco', 'fish', 'apple', 'pizza'],["apple","fish"]]
CommonElements2(Arrays)
#print(n ," set is equal to : ", placeHolder)
print()
Move_Check1 = move
@@ -653,6 +656,21 @@ func CommonElements(A,B,C):
if x in C:
count.push_back(x)
return count
func CommonElements2(Arrays):
var count = []
var deletions = []
for x in Arrays:
for n in Arrays[0]:
if n in x:
if count.find(n) == -1:
count.push_back(n)
else:
deletions.push_back(n)
for i in deletions:
count.erase(i)
print(count)
return count
#***** Movement *****
func goDown():