Starting the branching for multi-object-solve :)
This commit is contained in:
128
PlayerScript.gd
128
PlayerScript.gd
@@ -59,7 +59,7 @@ var CircleInts = 0
|
||||
var LogDumpOrdered = []
|
||||
var Order = []
|
||||
var Intersections_from_root = []
|
||||
var TargetCord = [0,-11] # HAD TO CHANGE TARGET CORD, IT WAS PREVIOUSLY [2,-10]
|
||||
var TargetCord = [[0,-11], [13,-13]] # HAD TO CHANGE TARGET CORD, IT WAS PREVIOUSLY [2,-10]
|
||||
var CircleCompleted = null
|
||||
var AutoBacktrack = false
|
||||
var IntersectionDict = {"Cord": [], "Data": [] }
|
||||
@@ -74,47 +74,52 @@ var FullCount = 0
|
||||
var Done = 0
|
||||
var Root = []
|
||||
var FirstGoTo = []
|
||||
var AllSetsToGoal = []
|
||||
var TargetsArray = []
|
||||
|
||||
func _input(event):
|
||||
if Current_Position != TargetCord:
|
||||
if event.is_action_pressed("ui_left"):
|
||||
goLeft()
|
||||
Been_There()
|
||||
AutoBacktrack = false
|
||||
elif event.is_action_pressed("ui_right"):
|
||||
goRight()
|
||||
Been_There()
|
||||
AutoBacktrack = false
|
||||
elif event.is_action_pressed("ui_up"):
|
||||
goUp()
|
||||
Been_There()
|
||||
AutoBacktrack = false
|
||||
elif event.is_action_pressed("ui_down"):
|
||||
goDown()
|
||||
Been_There()
|
||||
AutoBacktrack = false
|
||||
elif event.is_action_pressed("ui_accept"):
|
||||
AutoSolve()
|
||||
#if Current_Position != TargetCord:
|
||||
if event.is_action_pressed("ui_left"):
|
||||
goLeft()
|
||||
Been_There()
|
||||
AutoBacktrack = false
|
||||
elif event.is_action_pressed("ui_right"):
|
||||
goRight()
|
||||
Been_There()
|
||||
AutoBacktrack = false
|
||||
elif event.is_action_pressed("ui_up"):
|
||||
goUp()
|
||||
Been_There()
|
||||
AutoBacktrack = false
|
||||
elif event.is_action_pressed("ui_down"):
|
||||
goDown()
|
||||
Been_There()
|
||||
AutoBacktrack = false
|
||||
elif event.is_action_pressed("ui_accept"):
|
||||
AutoSolve()
|
||||
|
||||
func _process(delta):
|
||||
if Current_Position != TargetCord:
|
||||
CallableRaycastData()
|
||||
Mark(Prev_dir)
|
||||
WhatMove()
|
||||
BackTracking()
|
||||
GiveOrder()
|
||||
Intersection_Tree()
|
||||
Circling()
|
||||
CheckForTreeDeadEnds()
|
||||
TravelLog()
|
||||
DeadEndCircles()
|
||||
CircleRootsAndInts()
|
||||
SolvinCircleDeadEnds()
|
||||
MoveAfterIntersection()
|
||||
IntersectionWaysAvailable()
|
||||
IntersectionDumping()
|
||||
CordsDumping()
|
||||
FinishCircling()
|
||||
|
||||
CallableRaycastData()
|
||||
Mark(Prev_dir)
|
||||
WhatMove()
|
||||
BackTracking()
|
||||
GiveOrder()
|
||||
Intersection_Tree()
|
||||
Circling()
|
||||
CheckForTreeDeadEnds()
|
||||
TravelLog()
|
||||
DeadEndCircles()
|
||||
CircleRootsAndInts()
|
||||
SolvinCircleDeadEnds()
|
||||
MoveAfterIntersection()
|
||||
IntersectionWaysAvailable()
|
||||
IntersectionDumping()
|
||||
CordsDumping()
|
||||
FinishCircling()
|
||||
FoundGoal()
|
||||
#if Detail_Dict.Type == "3 Way Intersection":
|
||||
# print(Individual_Steps)
|
||||
#print(Detail_Dict.Type)
|
||||
#print(Ordered_Commands_Backward)
|
||||
#print(InverNext)
|
||||
@@ -126,28 +131,36 @@ func _process(delta):
|
||||
# print(Tree_Array)
|
||||
# print()
|
||||
# print("*****************************")
|
||||
else:
|
||||
if Done != 1:
|
||||
print("******************************")
|
||||
print()
|
||||
print()
|
||||
print("We Done!!!!!!!!!!!!!!!!!!!!!!!")
|
||||
print()
|
||||
print()
|
||||
print("******************************")
|
||||
#print("The last Ordered commands were: ", LogDump)
|
||||
|
||||
#AutoSolve()
|
||||
#for n in Individual_Steps:
|
||||
#print(n)
|
||||
#GoBack(n)
|
||||
#print(CordsDump)
|
||||
|
||||
|
||||
|
||||
func FoundGoal():
|
||||
if TargetCord.find(Current_Position) != -1 and TargetsArray.find(Current_Position) == -1:
|
||||
print("GOAL!!!!!!!!!!!")
|
||||
if Done != move:
|
||||
print("Circling is: ", Cicling)
|
||||
print("Current Pos: ", Current_Position)
|
||||
print(Intersections)
|
||||
Mark(Prev_dir)
|
||||
TrackIntersections()
|
||||
BackToStart()
|
||||
for n in Individual_Steps:
|
||||
#print(n)
|
||||
GoBack(n)
|
||||
#print(CordsDump)
|
||||
TargetsArray.push_back(Current_Position)
|
||||
AllSetsToGoal.push_back(Individual_Steps)
|
||||
AllSetsToGoal.push_back(" BUFFER ")
|
||||
var TargetCopy = TargetsArray.duplicate(true)
|
||||
var SetsCopy = AllSetsToGoal.duplicate(true)
|
||||
TargetsArray = TargetCopy
|
||||
AllSetsToGoal = SetsCopy
|
||||
|
||||
print("Here is the Set to go to young bull: ",AllSetsToGoal)
|
||||
Done = move
|
||||
|
||||
Done = 1
|
||||
|
||||
func Mark(Prev_Direction):
|
||||
|
||||
@@ -165,8 +178,6 @@ func BackToStart():
|
||||
print(Detail_Dict.Type)
|
||||
if Detail_Dict.Type == "Plain Path" and Cicling == false:
|
||||
print("PLAIN PATH NORMAL")
|
||||
Ordered_Commands_Backward.push_front(Prev_dir_Opp)
|
||||
print(Ordered_Commands_Backward)
|
||||
Individual_Steps.push_front(Ordered_Commands_Backward)
|
||||
print(Individual_Steps)
|
||||
|
||||
@@ -176,9 +187,10 @@ func BackToStart():
|
||||
|
||||
if Intersections.find(Current_Position) != -1:
|
||||
print("INTERSECTION NORMAL")
|
||||
Ordered_Commands_Backward.push_back(Prev_dir_Opp)
|
||||
Ordered_Commands_Backward.reverse()
|
||||
Individual_Steps.push_front(Ordered_Commands_Backward)
|
||||
#Ordered_Commands_Backward.push_back(Prev_dir_Opp)
|
||||
#Ordered_Commands_Backward.reverse()
|
||||
if Ordered_Commands_Backward.size() > 0:
|
||||
Individual_Steps.push_front(Ordered_Commands_Backward)
|
||||
print(Individual_Steps)
|
||||
|
||||
if Detail_Dict.Type == "Dead End":
|
||||
|
||||
Reference in New Issue
Block a user