AI refactor

This commit is contained in:
2021-05-14 12:04:12 +02:00
parent 2dd3756682
commit 0b26761be5
14 changed files with 282 additions and 762 deletions
+6 -1
View File
@@ -137,6 +137,9 @@ performAction cr w ac = case ac of
(imps, Just ac) -> (imps, Just $ DoActionWhilePartial ac f resetAc)
(imps, _) -> (imps, Just $ DoActionWhilePartial resetAc f resetAc)
| otherwise -> performAction cr w partAc
DoActionIf f ac
| f (w,cr) -> performAction cr w ac
| otherwise -> ([],Nothing)
DoActionIfElse ac f ac'
| f (w,cr) -> performAction cr w ac
| otherwise -> performAction cr w ac'
@@ -164,7 +167,9 @@ performAction cr w ac = case ac of
_ -> ([],Nothing)
UseAheadPos f -> performAction cr w (f (_crPos cr +.+ 20 *.* unitVectorAtAngle (_crDir cr)))
ArbitraryAction f -> performAction cr w (f cr w)
DoImpulsesAlongside sideImpulses mainAc -> undefined
DoImpulsesAlongside sideImp mainAc -> case performAction cr w mainAc of
(imp, Just ac) -> (sideImp ++ imp, Just $ DoImpulsesAlongside sideImp ac)
(imp, _) -> (sideImp ++ imp, Nothing)
DoReplicate t ac -> performAction cr w $ DoReplicatePartial ac t ac
DoReplicatePartial _ 0 ac' -> performAction cr w ac'
DoReplicatePartial ac t ac' -> case performAction cr w ac' of