Skip to content

Instantly share code, notes, and snippets.

@clrnd
Created October 3, 2016 23:27
Show Gist options
  • Save clrnd/727462306a915cfc3e36d94702b4cb9b to your computer and use it in GitHub Desktop.
Save clrnd/727462306a915cfc3e36d94702b4cb9b to your computer and use it in GitHub Desktop.
2015_1er_parcial_2ndo_c_p1.hs
module Main where
data Ball = R | B deriving (Show, Eq)
data Coin = Ca | Ce deriving (Show, Eq)
s_a = [(Ca, [a, b, c, d]) | a <- l, b <- l, c <- l, d <- l]
where l = [R, R, R, R, B, B]
s_e = [(Ce, [a, b, c, d]) | a <- l, b <- l, c <- l, d <- l]
where l = [R, R, B, B, B, B]
s_s = s_a ++ s_e
next_two_red (_, [R, R, R, B]) = True
next_two_red (_, [R, R, B, R]) = True
next_two_red (_, [R, R, R, R]) = True
next_two_red _ = False
has_red (_, [R, _, _, _]) = True
has_red (_, [_, R, _, _]) = True
has_red (_, [_, _, R, _]) = True
has_red (_, [_, _, _, R]) = True
has_red _ = False
cara (Ca, _) = True
cara _ = False
ceca (Ce, _) = True
ceca _ = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment