From 6b05323ded8f46c6d89adbb00a8562a4fe825350 Mon Sep 17 00:00:00 2001 From: Jamal Millner II Date: Mon, 28 Oct 2024 08:11:28 -0400 Subject: [PATCH] Got the depth search and the trunk working --- PlayerScript.gd | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/PlayerScript.gd b/PlayerScript.gd index e215b63..32e5ffd 100644 --- a/PlayerScript.gd +++ b/PlayerScript.gd @@ -182,39 +182,19 @@ 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(): - print(n ," set is equal to : ", AllSetsToGoal[n] ) + var placeHolder = [] + placeHolder = AllSetsToGoal[n] + placeHolder.slice(Trunk[-1]) + print(n ," set is equal to : ", placeHolder ) print() - print("The size for ", n, " is: ", AllSetsToGoal[n].size()) - CurrentInstructionSet.push_back(AllSetsToGoal[n].size()) - print("The max is: ", (CurrentInstructionSet).max()) - var key = CurrentInstructionSet.find(CurrentInstructionSet.max()) - print("THIS IS THE KEY: ") - print(AllSetsToGoal[key]) - print() - print("***********************************") - for i in AllSetsToGoal.size(): - if i != key: - print("The I value is: ", i) - for x in AllSetsToGoal[key]: - if AllSetsToGoal[i].find(x) != -1: - var test = [] - test.push_back(AllSetsToGoal[i].find(x)) - PreTrunk.push_back(test) - print(AllSetsToGoal[i]) - PreTrunk.erase(PreTrunk.min()) - PreTrunk = PreTrunk.min() - #print(PreTrunk[0]) - Trunk = AllSetsToGoal[key].slice(PreTrunk[0]+1) - print("This is the trunk: ") - print(Trunk) - print("Test Print ^^^") Move_Check1 = move - func Mark(Prev_Direction): var response = ways[IntersectionCounter()] @@ -664,6 +644,15 @@ func TypeOfIntersectionHelper(): 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 #***** Movement ***** func goDown():