Circles are almost done git rid of duplication
This commit is contained in:
@@ -30,7 +30,9 @@ var move_check = 0
|
||||
var ways = ["None", "Dead End", "Plain Path", "3 Way Intersection", "4 Way Intersection"]
|
||||
var ignore = false
|
||||
var Ordered_Commands_Backward = []
|
||||
var Ordered_Commands_Forward = []
|
||||
var Individual_Steps = []
|
||||
var Individual_Steps_Opp = []
|
||||
var Back_To_Start = []
|
||||
var Command = []
|
||||
var TakeOut = 0
|
||||
@@ -50,6 +52,7 @@ var Move_Check6 = 0
|
||||
var Move_Check7 = 0
|
||||
var Move_Check4 = 0
|
||||
var Move_Check9 = 0
|
||||
var Move_Check10 = 0
|
||||
var Cicling = false
|
||||
var CircleIntsMax = 0
|
||||
var CircleInts = 0
|
||||
@@ -70,6 +73,7 @@ var CordsDump = []
|
||||
var FullCount = 0
|
||||
var Done = 0
|
||||
var Root = []
|
||||
var FirstGoTo = []
|
||||
|
||||
func _input(event):
|
||||
if Current_Position != TargetCord:
|
||||
@@ -110,6 +114,8 @@ func _process(delta):
|
||||
IntersectionWaysAvailable()
|
||||
IntersectionDumping()
|
||||
CordsDumping()
|
||||
FinishCircling()
|
||||
#print(Ordered_Commands_Backward)
|
||||
#print(InverNext)
|
||||
#print(CordsDump)
|
||||
else:
|
||||
@@ -168,6 +174,7 @@ func BackTracking():
|
||||
BackTrack_Array.push_back(move)
|
||||
if Intersections.find(Current_Position) == -1 and Intersections.find(Current_Position) != Intersections.size() -1 and BackTrack_Array.size() >= 2:
|
||||
TrackBack = GiveOrder()
|
||||
Individual_Steps_Opp.push_back(Ordered_Commands_Forward)
|
||||
#print(TrackBack)
|
||||
Distance_From_Intersection = BackTrack_Array[-1] - BackTrack_Array[-2]
|
||||
print("The distance from the last intersection is : ", Distance_From_Intersection)
|
||||
@@ -192,6 +199,8 @@ func Circling():
|
||||
for n in CircleIntsMax:
|
||||
Individual_Steps.pop_front()
|
||||
GoBack(Individual_Steps[0])
|
||||
Cicling = false
|
||||
print("Circling is false!!!!")
|
||||
|
||||
if CircleInts != 0:
|
||||
print("Go back to circle part :(")
|
||||
@@ -217,40 +226,51 @@ func FirstCirclePart():
|
||||
|
||||
print("Skipping Array is : ", Skipping_array)
|
||||
|
||||
for x in Skipping_array:
|
||||
print("This is X: ",x)
|
||||
|
||||
print("This is X: ",Skipping_array[0])
|
||||
|
||||
if Tree_Array[Skipping_array[0]] == 1:
|
||||
print("Skip")
|
||||
Skip()
|
||||
|
||||
if Tree_Array[x] == 1:
|
||||
print("Skip")
|
||||
Skip()
|
||||
|
||||
else:
|
||||
print("Go To")
|
||||
#Goto()
|
||||
else:
|
||||
print("Go To")
|
||||
Goto()
|
||||
|
||||
func Skip():
|
||||
#print("CircleInts: ", CircleInts, " and CircleInts Max: ", CircleIntsMax)
|
||||
print("CircleInts: ", CircleInts, " and CircleInts Max: ", CircleIntsMax)
|
||||
if CircleInts + 1 == CircleIntsMax:
|
||||
FirstIntChange()
|
||||
GoBack(Individual_Steps[0])
|
||||
Individual_Steps.pop_front()
|
||||
print("First Go To is : ",FirstGoTo)
|
||||
else:
|
||||
for n in 2:
|
||||
print("N is equal to: ",n)
|
||||
GoBack(Individual_Steps[0])
|
||||
Individual_Steps.pop_front()
|
||||
print("Needs More WORK!!!!!!!")
|
||||
print("First Go To is : ",FirstGoTo)
|
||||
|
||||
func Goto():
|
||||
if CircleInts + 1 == CircleIntsMax:
|
||||
print("CircleInts: ", CircleInts, " and CircleInts Max: ", CircleIntsMax)
|
||||
if CircleInts == CircleIntsMax:
|
||||
print("FIRST CHANGE")
|
||||
FirstIntChange()
|
||||
print("Shouldn't Need more work")
|
||||
else:
|
||||
GoBack(Individual_Steps[0])
|
||||
Individual_Steps.pop_front()
|
||||
print("FIRST CHANGE")
|
||||
FirstIntChange()
|
||||
print("Needs More WORK!!!!!!!")
|
||||
print("First Go To is : ",FirstGoTo)
|
||||
|
||||
|
||||
func FirstIntChange():
|
||||
var FirstGoTo = []
|
||||
FirstGoTo.push_front(Prev_dir_Opp)
|
||||
FirstGoTo.append_array(Ordered_Commands_Backward)
|
||||
FirstGoTo.push_back(Prev_dir_Opp)
|
||||
FirstGoTo.reverse()
|
||||
print(Intersections_from_root)
|
||||
print(Ordered_Commands_Backward)
|
||||
GoBack(FirstGoTo)
|
||||
print(FirstGoTo)
|
||||
|
||||
@@ -259,11 +279,34 @@ func CircleRootsAndInts():
|
||||
if Cicling == true:
|
||||
if Detail_Dict.Type != "Plain Path":
|
||||
if Intersections_from_root.find(Current_Position) == -1:
|
||||
if Intersections_from_root.size() == 0:
|
||||
print(Intersections)
|
||||
print(Intersections[-(CircleIntsMax+1)])
|
||||
Intersections_from_root.push_back(Intersections[-(CircleIntsMax+1)])
|
||||
Intersections_from_root.push_back(Current_Position)
|
||||
var Duplicate = Intersections_from_root.duplicate(true)
|
||||
Intersections_from_root = Duplicate
|
||||
print(Intersections_from_root)
|
||||
|
||||
func FinishCircling():
|
||||
if Cicling == true:
|
||||
if Move_Check10 != move:
|
||||
if CircleInts == 0:
|
||||
if Current_Position == Intersections[-(CircleIntsMax+1)]:
|
||||
Cicling == false
|
||||
print("DONE!!!!!!!!")
|
||||
GoBack(Individual_Steps[0])
|
||||
|
||||
else:
|
||||
Cicling = false
|
||||
print("DONE!!!!!!!!")
|
||||
GoBack(Individual_Steps[0])
|
||||
Individual_Steps.pop_front()
|
||||
GoBack(Individual_Steps[0])
|
||||
Individual_Steps.pop_front()
|
||||
print(Individual_Steps)
|
||||
Move_Check10 = move
|
||||
|
||||
func DeadEndCircles():
|
||||
if Cicling == true:
|
||||
if Detail_Dict.Type == "Dead End":
|
||||
@@ -334,6 +377,7 @@ func CheckForTreeDeadEnds():
|
||||
|
||||
func GiveOrder():
|
||||
Ordered_Commands_Backward.erase("")
|
||||
Ordered_Commands_Forward.erase("")
|
||||
if move_check != move:
|
||||
TrackIntersections()
|
||||
if Detail_Dict.Been_There == false:
|
||||
@@ -428,6 +472,7 @@ func IntersectionWaysAvailable():
|
||||
func BackToStart():
|
||||
if Detail_Dict.Type == "Plain Path":
|
||||
Individual_Steps.push_front(Ordered_Commands_Backward)
|
||||
Individual_Steps_Opp.push_front(Ordered_Commands_Forward)
|
||||
|
||||
func Been_There():
|
||||
if Been_There_Overide == false:
|
||||
|
||||
Reference in New Issue
Block a user