module GeneralStrategies where
|
|
|
|
import Data.Maybe
|
|
import Datatypes
|
|
import PowerPhrases
|
|
import VM
|
|
|
|
executePhrase :: String -> Game -> [(Game, Notes)]
|
|
executePhrase str game = foldl cmdprop [(game,OK)] commands
|
|
where
|
|
commands = mapMaybe charToCommand str
|
|
cmdprop (x:xs) cmd = (fst (step (fst x) cmd), notesfilter (snd (step (fst x) cmd)) (snd x)):x:xs
|
|
|
|
notesfilter :: Notes -> Notes -> Notes
|
|
notesfilter a b = if b == ErrorZero
|
|
then ErrorZero
|
|
else if a == Ended
|
|
then Ended
|
|
else OK
|