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,22 +297,39 @@ func TrackIntersections():
func MoveAfterIntersection(): func MoveAfterIntersection():
if move == IntersectionMove+1: if move == IntersectionMove+1:
if InverNext == false:
if Move_Check6 != move: if Move_Check6 != move:
if TrackBack.size() != 1 and BackTrack_Array.size() > 1: if TrackBack.size() != 1 and BackTrack_Array.size() > 1:
IntersectionDir.push_back(LogDumpOrdered[0]) IntersectionDir.push_back(LogDumpOrdered[0])
if BackTrack_Array[-1] - BackTrack_Array[-2] == 1: if BackTrack_Array.size() > 1 and BackTrack_Array[-1] - BackTrack_Array[-2] == 1:
print(Prev_dir_Opp) InvertionArray.pop_back()
InverNext = true
else: else:
print(Prev_dir) InverNext = false
else: else:
IntersectionDir.push_back(LogDump[0]) IntersectionDir.push_back(LogDump[0])
if BackTrack_Array.size() > 1 and BackTrack_Array[-1] - BackTrack_Array[-2] == 1: 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)
CallingDir() print(InvertionArray)
print("The Test is here !!!", IntOptions) #print("The Test is here !!!", IntOptions)
Move_Check6 = move Move_Check6 = move
else:
InverNext = false
MoveAfterIntersection()
func CallingDir(): func CallingDir():
if Intersections.find(Current_Position) != -1 and IntOptions.size() > 1: if Intersections.find(Current_Position) != -1 and IntOptions.size() > 1: