Depth search improved with array instead of individual vars. I need to fix trunk system its not working :(
This commit is contained in:
@@ -102,6 +102,7 @@ func _input(event):
|
|||||||
AutoBacktrack = false
|
AutoBacktrack = false
|
||||||
elif event.is_action_pressed("ui_accept"):
|
elif event.is_action_pressed("ui_accept"):
|
||||||
AutoSolve()
|
AutoSolve()
|
||||||
|
|
||||||
#print(Tree_Array)
|
#print(Tree_Array)
|
||||||
# print(Current_Position)
|
# print(Current_Position)
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
@@ -182,16 +183,18 @@ func FoundGoal():
|
|||||||
func AllObjectsFound():
|
func AllObjectsFound():
|
||||||
if Tree_Array_SetStart != Tree_Array[0]:
|
if Tree_Array_SetStart != Tree_Array[0]:
|
||||||
var CurrentInstructionSet = []
|
var CurrentInstructionSet = []
|
||||||
Trunk = CommonElements(AllSetsToGoal[0], AllSetsToGoal[1], AllSetsToGoal[2])
|
|
||||||
print("This is the Trunk ", Trunk)
|
|
||||||
if Move_Check1 != move:
|
if Move_Check1 != move:
|
||||||
print("We Done!!!!!!!!!!!!!!!!!")
|
print("We Done!!!!!!!!!!!!!!!!!")
|
||||||
print()
|
print()
|
||||||
for n in AllSetsToGoal.size():
|
for n in AllSetsToGoal.size():
|
||||||
var placeHolder = []
|
var placeHolder = []
|
||||||
placeHolder = AllSetsToGoal[n]
|
#placeHolder = AllSetsToGoal[n]
|
||||||
placeHolder.slice(Trunk[-1])
|
#placeHolder.slice(placeHolder.find(Trunk[-1]))
|
||||||
print(n ," set is equal to : ", placeHolder )
|
#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()
|
print()
|
||||||
Move_Check1 = move
|
Move_Check1 = move
|
||||||
|
|
||||||
@@ -653,6 +656,21 @@ func CommonElements(A,B,C):
|
|||||||
if x in C:
|
if x in C:
|
||||||
count.push_back(x)
|
count.push_back(x)
|
||||||
return count
|
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 *****
|
#***** Movement *****
|
||||||
|
|
||||||
func goDown():
|
func goDown():
|
||||||
|
|||||||
Reference in New Issue
Block a user