remembered /= exists
This commit is contained in:
parent
eaf8b1c594
commit
d83589875d
7
day2.hs
7
day2.hs
|
@ -26,7 +26,7 @@ validB (Password a' b' t p) =
|
||||||
(False,False) -> False
|
(False,False) -> False
|
||||||
(True,False) -> (p !! a) == t
|
(True,False) -> (p !! a) == t
|
||||||
(False,True) -> (p !! b) == t
|
(False,True) -> (p !! b) == t
|
||||||
_ -> xor ((p !! a) == t) ((p !! b) == t)
|
_ -> ((p !! a) == t) /= ((p !! b) == t)
|
||||||
where
|
where
|
||||||
a = (pred a')
|
a = (pred a')
|
||||||
b = (pred b')
|
b = (pred b')
|
||||||
|
@ -53,11 +53,6 @@ dropChar :: String -> String
|
||||||
dropChar [] = []
|
dropChar [] = []
|
||||||
dropChar (_:ls) = ls
|
dropChar (_:ls) = ls
|
||||||
|
|
||||||
xor :: Bool -> Bool -> Bool
|
|
||||||
xor True False = True
|
|
||||||
xor False True = True
|
|
||||||
xor _ _ = False
|
|
||||||
|
|
||||||
inBounds :: Int -> Int -> String -> (Bool, Bool)
|
inBounds :: Int -> Int -> String -> (Bool, Bool)
|
||||||
inBounds a b s = ( len >= a, len >= b )
|
inBounds a b s = ( len >= a, len >= b )
|
||||||
where len = length s
|
where len = length s
|
||||||
|
|
Loading…
Reference in a new issue