You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
576 B

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