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:
2024-10-30 08:13:01 -04:00
parent d550fca787
commit 29b5831c86

View File

@@ -81,6 +81,7 @@ var TargetsArray = []
var Goal = false
var Trunk = []
var PreTrunk = []
var count = {}
func _input(event):
#if Current_Position != TargetCord:
@@ -102,7 +103,8 @@ func _input(event):
AutoBacktrack = false
elif event.is_action_pressed("ui_accept"):
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(Current_Position)
func _process(delta):
@@ -193,7 +195,13 @@ func AllObjectsFound():
#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)
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()
Move_Check1 = move
@@ -258,6 +266,15 @@ func CirclingParody():
Individual_Steps.push_front(addition)
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():
if Detail_Dict.Been_There == true:
if state4 != 1:
@@ -641,21 +658,41 @@ func RaycastHelper():
var U: bool = $Backv.is_colliding()
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():
if Detail_Dict.Type != "Plain Path" and Detail_Dict.Type != "Dead End":
return "BlanketIntersection"
else:
return "OneDirectionPath"
func CommonElements(A,B,C):
var count = []
for x in A:
#print(x)
if x in B:
#print(x, " is found in B")
if x in C:
count.push_back(x)
return count
func Instances(Arrays):
for x in Arrays:
for n in x:
if count.get(n) == null:
count[n] = 0
if count.get(n) != null:
count[n] += 1
print(count)
func CommonElements2(Arrays):
var count = []
var deletions = []