CircleAlgo first Part
This commit is contained in:
@@ -48,6 +48,7 @@ var move_check3 = 0
|
|||||||
var move_check5 = 0
|
var move_check5 = 0
|
||||||
var Move_Check6 = 0
|
var Move_Check6 = 0
|
||||||
var Move_Check7 = 0
|
var Move_Check7 = 0
|
||||||
|
var Move_Check4 = 0
|
||||||
var Move_Check9 = 0
|
var Move_Check9 = 0
|
||||||
var Cicling = false
|
var Cicling = false
|
||||||
var CircleIntsMax = 0
|
var CircleIntsMax = 0
|
||||||
@@ -178,11 +179,6 @@ func Circling():
|
|||||||
if Been_There_Array.size() > 3:
|
if Been_There_Array.size() > 3:
|
||||||
if move_check5 != move:
|
if move_check5 != move:
|
||||||
if Intersections.find(Current_Position) != Intersections.size()-1 and Intersections.find(Current_Position) != -1 and Been_There_Array[-2] == false and Been_There_Array[-3] == false:
|
if Intersections.find(Current_Position) != Intersections.size()-1 and Intersections.find(Current_Position) != -1 and Been_There_Array[-2] == false and Been_There_Array[-3] == false:
|
||||||
# var holder = []
|
|
||||||
# for n in (move - BackTrack_Array[-1]):
|
|
||||||
# holder.push_back(LogDump[n])
|
|
||||||
#holder.push_front(Prev_dir_Opp)
|
|
||||||
#print(holder)
|
|
||||||
print("Circling")
|
print("Circling")
|
||||||
Cicling = true
|
Cicling = true
|
||||||
#ndividual_Steps.push_front(holder)
|
#ndividual_Steps.push_front(holder)
|
||||||
@@ -194,9 +190,10 @@ func Circling():
|
|||||||
for n in CircleIntsMax:
|
for n in CircleIntsMax:
|
||||||
Individual_Steps.pop_front()
|
Individual_Steps.pop_front()
|
||||||
GoBack(Individual_Steps[0])
|
GoBack(Individual_Steps[0])
|
||||||
|
|
||||||
if CircleInts != 0:
|
if CircleInts != 0:
|
||||||
print("Go back to circle part :(")
|
print("Go back to circle part :(")
|
||||||
#FirstCirclePart()
|
FirstCirclePart()
|
||||||
move_check5 = move
|
move_check5 = move
|
||||||
|
|
||||||
func HowManyIntsInCircle():
|
func HowManyIntsInCircle():
|
||||||
@@ -210,30 +207,12 @@ func HowManyIntsInCircle():
|
|||||||
print(CircleInts)
|
print(CircleInts)
|
||||||
|
|
||||||
func FirstCirclePart():
|
func FirstCirclePart():
|
||||||
var count = CircleInts
|
var holder = []
|
||||||
|
for n in (move - BackTrack_Array[-1] + 1):
|
||||||
if count == 0 and Current_Position == Intersections_from_root[0]:
|
#holder.push_back(LogDump[n])
|
||||||
Cicling = false
|
holder.push_front(Prev_dir_Opp)
|
||||||
Intersection_Tree()
|
print(holder)
|
||||||
Ordered_Commands_Backward.clear()
|
GoBack(holder)
|
||||||
print("Ignoreeeeeee")
|
|
||||||
for takeout in CircleInts + 1:
|
|
||||||
Individual_Steps.pop_front()
|
|
||||||
Tree_Array.pop_back()
|
|
||||||
print("Goin back")
|
|
||||||
print(Individual_Steps)
|
|
||||||
GoBack(Individual_Steps[0])
|
|
||||||
CircleCompleted = true
|
|
||||||
#** Returning if it needs more work or not
|
|
||||||
return false
|
|
||||||
|
|
||||||
elif count != 0 and Current_Position == Intersections_from_root[0]:
|
|
||||||
GoBack(Individual_Steps[0])
|
|
||||||
Individual_Steps.pop_front()
|
|
||||||
print("Number Of Ints: ", CircleInts)
|
|
||||||
print(Individual_Steps)
|
|
||||||
#** Returning if it needs more work or not
|
|
||||||
return true
|
|
||||||
|
|
||||||
func CircleRootsAndInts():
|
func CircleRootsAndInts():
|
||||||
if Cicling == true:
|
if Cicling == true:
|
||||||
@@ -242,12 +221,11 @@ func CircleRootsAndInts():
|
|||||||
Intersections_from_root.push_back(Current_Position)
|
Intersections_from_root.push_back(Current_Position)
|
||||||
var Duplicate = Intersections_from_root.duplicate(true)
|
var Duplicate = Intersections_from_root.duplicate(true)
|
||||||
Intersections_from_root = Duplicate
|
Intersections_from_root = Duplicate
|
||||||
|
print(Intersections_from_root)
|
||||||
|
|
||||||
func DeadEndCircles():
|
func DeadEndCircles():
|
||||||
if Cicling == true:
|
if Cicling == true:
|
||||||
if Detail_Dict.Type == "Dead End":
|
if Detail_Dict.Type == "Dead End":
|
||||||
if AutoBacktrack == true:
|
|
||||||
CircleIntSubtractor()
|
|
||||||
return true
|
return true
|
||||||
else:
|
else:
|
||||||
return false
|
return false
|
||||||
@@ -256,21 +234,20 @@ func SolvinCircleDeadEnds():
|
|||||||
if CircleManualDistance() != null:
|
if CircleManualDistance() != null:
|
||||||
for n in CircleManualDistance():
|
for n in CircleManualDistance():
|
||||||
GoBack(LogDump[n])
|
GoBack(LogDump[n])
|
||||||
|
#print(Individual_Steps[0])
|
||||||
|
CircleInts -= 1
|
||||||
|
GoBack(Individual_Steps[0])
|
||||||
|
print(CircleInts)
|
||||||
|
|
||||||
func CircleComplete():
|
func CircleManualDistance():
|
||||||
if CircleCompleted == true:
|
if DeadEndCircles() == true and Intersections_from_root.size() >= 2:
|
||||||
if Detail_Dict.Type != "Plain Path" and Detail_Dict.Been_There == false:
|
var Starting_Pos = Intersections_from_root[-2]
|
||||||
Individual_Steps.push_front(GiveOrder())
|
var Ending_Pos = Intersections_from_root[-1]
|
||||||
print("Circle Complete")
|
|
||||||
print(Individual_Steps)
|
var x = abs(Starting_Pos[0] - Ending_Pos[0])
|
||||||
print(Tree_Array)
|
var y = abs(Starting_Pos[1] - Ending_Pos[1])
|
||||||
CircleCompleted = false
|
return x+y
|
||||||
else:
|
|
||||||
pass
|
|
||||||
|
|
||||||
func CircleIntSubtractor():
|
|
||||||
CircleInts -= 1
|
|
||||||
print(CircleInts)
|
|
||||||
|
|
||||||
func Intersection_Tree():
|
func Intersection_Tree():
|
||||||
if Cicling == false:
|
if Cicling == false:
|
||||||
@@ -304,14 +281,6 @@ func CheckForTreeDeadEnds():
|
|||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func CircleManualDistance():
|
|
||||||
if DeadEndCircles() == true and Intersections_from_root.size() >= 2:
|
|
||||||
var Starting_Pos = Intersections_from_root[-2]
|
|
||||||
var Ending_Pos = Intersections_from_root[-1]
|
|
||||||
|
|
||||||
var x = abs(Starting_Pos[0] - Ending_Pos[0])
|
|
||||||
var y = abs(Starting_Pos[1] - Ending_Pos[1])
|
|
||||||
return x+y
|
|
||||||
|
|
||||||
func GiveOrder():
|
func GiveOrder():
|
||||||
Ordered_Commands_Backward.erase("")
|
Ordered_Commands_Backward.erase("")
|
||||||
|
|||||||
Reference in New Issue
Block a user