Fixing which move youve directed

This commit is contained in:
2024-09-25 08:11:02 -04:00
parent c9f5dcd642
commit 58b24176ab

View File

@@ -60,6 +60,8 @@ var IntersectionDir = []
var IntersectionMove = 0 var IntersectionMove = 0
var IntOptions = [] var IntOptions = []
var CurrentInt = "" var CurrentInt = ""
var InverNext = false
var InvertionArray = []
func _input(event): func _input(event):
if Current_Position != TargetCord: if Current_Position != TargetCord:
@@ -99,6 +101,7 @@ func _process(delta):
MoveAfterIntersection() MoveAfterIntersection()
IntersectionWaysAvailable() IntersectionWaysAvailable()
IntersectionDumping() IntersectionDumping()
#print(InverNext)
else: else:
print("We Done!!!!!!!!!!!!!!!!!!!!!!!") print("We Done!!!!!!!!!!!!!!!!!!!!!!!")
@@ -277,7 +280,7 @@ func GiveOrder():
TrackIntersections() TrackIntersections()
if Detail_Dict.Been_There == false: if Detail_Dict.Been_There == false:
Ordered_Commands_Backward.push_back(Prev_dir_Opp) Ordered_Commands_Backward.push_back(Prev_dir_Opp)
if Detail_Dict.Type != "Plain Path": if Detail_Dict.Type != "Plain Path" and Intersections.size() > 1:
TakeOut = (Cords.size() - Cords.find(Intersections[-2])) TakeOut = (Cords.size() - Cords.find(Intersections[-2]))
var test = Ordered_Commands_Backward.slice(0 , TakeOut) var test = Ordered_Commands_Backward.slice(0 , TakeOut)
test.reverse() test.reverse()
@@ -294,23 +297,40 @@ func TrackIntersections():
func MoveAfterIntersection(): func MoveAfterIntersection():
if move == IntersectionMove+1: if move == IntersectionMove+1:
if Move_Check6 != move: if InverNext == false:
if TrackBack.size() != 1 and BackTrack_Array.size() > 1: if Move_Check6 != move:
IntersectionDir.push_back(LogDumpOrdered[0]) if TrackBack.size() != 1 and BackTrack_Array.size() > 1:
if BackTrack_Array[-1] - BackTrack_Array[-2] == 1: IntersectionDir.push_back(LogDumpOrdered[0])
if BackTrack_Array.size() > 1 and BackTrack_Array[-1] - BackTrack_Array[-2] == 1:
InvertionArray.pop_back()
InverNext = true
else:
InverNext = false
else:
IntersectionDir.push_back(LogDump[0])
if BackTrack_Array.size() > 1 and BackTrack_Array[-1] - BackTrack_Array[-2] == 1:
InvertionArray.pop_back()
InverNext = true
elif BackTrack_Array.size() > 1 and BackTrack_Array[-1] - BackTrack_Array[-2] != 1:
InverNext = false
InvertionArray.push_back(InverNext)
CallingDir()
if InvertionArray.size() > 1 and InvertionArray[-2] == true and InvertionArray[-1] == false:
print(Prev_dir_Opp) print(Prev_dir_Opp)
if InvertionArray.size() >1 and InvertionArray[-1] == true and InvertionArray[-2] == false:
print(Prev_dir_Opp)
else: else:
print(Prev_dir) print(Prev_dir)
else: print(InvertionArray)
IntersectionDir.push_back(LogDump[0]) #print("The Test is here !!!", IntOptions)
if BackTrack_Array.size() > 1 and BackTrack_Array[-1] - BackTrack_Array[-2] == 1: Move_Check6 = move
print(Prev_dir_Opp) else:
else: InverNext = false
print(Prev_dir) MoveAfterIntersection()
CallingDir()
print("The Test is here !!!", IntOptions)
Move_Check6 = move
func CallingDir(): func CallingDir():
if Intersections.find(Current_Position) != -1 and IntOptions.size() > 1: if Intersections.find(Current_Position) != -1 and IntOptions.size() > 1:
print(IntOptions[Intersections.find(Current_Position)-1]) print(IntOptions[Intersections.find(Current_Position)-1])