Many improvements including common elements search is working along with the trunk deletions. Also instances functions allowing for easy data tracking is done. Fix the full reverse function because data is flipped
This commit is contained in:
@@ -81,6 +81,7 @@ var TargetsArray = []
|
|||||||
var Goal = false
|
var Goal = false
|
||||||
var Trunk = []
|
var Trunk = []
|
||||||
var PreTrunk = []
|
var PreTrunk = []
|
||||||
|
var count = {}
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
#if Current_Position != TargetCord:
|
#if Current_Position != TargetCord:
|
||||||
@@ -102,7 +103,8 @@ func _input(event):
|
|||||||
AutoBacktrack = false
|
AutoBacktrack = false
|
||||||
elif event.is_action_pressed("ui_accept"):
|
elif event.is_action_pressed("ui_accept"):
|
||||||
AutoSolve()
|
AutoSolve()
|
||||||
|
var Arrays = [['apple', 'orange', 'banana', 'pear', 'fish', 'pancake', 'taco', 'pizza'],['banana', 'pizza', 'fish', 'apple'],['taco', 'fish', 'apple', 'pizza'],["apple","fish"]]
|
||||||
|
#Instances(Arrays)
|
||||||
#print(Tree_Array)
|
#print(Tree_Array)
|
||||||
# print(Current_Position)
|
# print(Current_Position)
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
@@ -193,7 +195,13 @@ func AllObjectsFound():
|
|||||||
#Trunk = CommonElements(AllSetsToGoal[0], AllSetsToGoal[1], AllSetsToGoal[2])
|
#Trunk = CommonElements(AllSetsToGoal[0], AllSetsToGoal[1], AllSetsToGoal[2])
|
||||||
#print("This is the Trunk ", Trunk)
|
#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"]]
|
var Arrays = [['apple', 'orange', 'banana', 'pear', 'fish', 'pancake', 'taco', 'pizza'],['banana', 'pizza', 'fish', 'apple'],['taco', 'fish', 'apple', 'pizza'],["apple","fish"]]
|
||||||
CommonElements2(Arrays)
|
Trunk = CommonElements2(AllSetsToGoal)
|
||||||
|
print("This is the trunk: ", Trunk)
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
AllSetsToGoal = TrunkDelete()
|
||||||
|
Instances(AllSetsToGoal)
|
||||||
|
FullReverse(AllSetsToGoal)
|
||||||
#print(n ," set is equal to : ", placeHolder)
|
#print(n ," set is equal to : ", placeHolder)
|
||||||
print()
|
print()
|
||||||
Move_Check1 = move
|
Move_Check1 = move
|
||||||
@@ -258,6 +266,15 @@ func CirclingParody():
|
|||||||
Individual_Steps.push_front(addition)
|
Individual_Steps.push_front(addition)
|
||||||
print(Individual_Steps)
|
print(Individual_Steps)
|
||||||
|
|
||||||
|
func TrunkDelete():
|
||||||
|
var returnArray = []
|
||||||
|
for n in AllSetsToGoal:
|
||||||
|
for i in Trunk:
|
||||||
|
n.erase(i)
|
||||||
|
returnArray.push_back(n)
|
||||||
|
#print(returnArray)
|
||||||
|
return returnArray
|
||||||
|
|
||||||
func WhatMove():
|
func WhatMove():
|
||||||
if Detail_Dict.Been_There == true:
|
if Detail_Dict.Been_There == true:
|
||||||
if state4 != 1:
|
if state4 != 1:
|
||||||
@@ -641,21 +658,41 @@ func RaycastHelper():
|
|||||||
var U: bool = $Backv.is_colliding()
|
var U: bool = $Backv.is_colliding()
|
||||||
return [R,L,U,D]
|
return [R,L,U,D]
|
||||||
|
|
||||||
|
func FullReverse(data):
|
||||||
|
var vars = []
|
||||||
|
print(data)
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
data.reverse()
|
||||||
|
print(data)
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
for n in data:
|
||||||
|
n.reverse()
|
||||||
|
vars.push_back(n)
|
||||||
|
print("vars: ")
|
||||||
|
print()
|
||||||
|
print(vars)
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
|
||||||
func TypeOfIntersectionHelper():
|
func TypeOfIntersectionHelper():
|
||||||
if Detail_Dict.Type != "Plain Path" and Detail_Dict.Type != "Dead End":
|
if Detail_Dict.Type != "Plain Path" and Detail_Dict.Type != "Dead End":
|
||||||
return "BlanketIntersection"
|
return "BlanketIntersection"
|
||||||
else:
|
else:
|
||||||
return "OneDirectionPath"
|
return "OneDirectionPath"
|
||||||
|
|
||||||
func CommonElements(A,B,C):
|
func Instances(Arrays):
|
||||||
var count = []
|
|
||||||
for x in A:
|
for x in Arrays:
|
||||||
#print(x)
|
for n in x:
|
||||||
if x in B:
|
if count.get(n) == null:
|
||||||
#print(x, " is found in B")
|
count[n] = 0
|
||||||
if x in C:
|
if count.get(n) != null:
|
||||||
count.push_back(x)
|
count[n] += 1
|
||||||
return count
|
|
||||||
|
print(count)
|
||||||
|
|
||||||
func CommonElements2(Arrays):
|
func CommonElements2(Arrays):
|
||||||
var count = []
|
var count = []
|
||||||
var deletions = []
|
var deletions = []
|
||||||
|
|||||||
Reference in New Issue
Block a user