This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE LambdaCase #-} | |
module Loupe | |
( analyze | |
, analyze' | |
, analyzeMay | |
) where | |
import Language.Haskell.Exts.Parser | |
import Language.Haskell.Exts.SrcLoc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MasterMindCodes where | |
main :: IO () | |
main = writeFile "/tmp/MasterMindCodes.txt" | |
. unlines | |
. map (unwords . map show) | |
$ codes | |
codes :: [[Int]] | |
codes = do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MasterMindCodes where | |
import Data.List | |
main :: IO () | |
main = writeFile "/tmp/MasterMindCodes.txt" | |
. unlines | |
. map (unwords . map show) | |
$ codes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 | |
1 2 | |
1 2 3 | |
1 2 3 5 | |
1 2 3 5 4 | |
1 2 3 5 4 7 8 6 9 | |
1 2 3 5 4 7 8 9 6 | |
1 2 3 5 6 | |
1 2 3 5 6 9 8 4 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SwipeCodes where | |
import Data.List | |
-- [x] Between 5 to 8 "digits" | |
-- [x] At least 1 horizontal line was filled | |
-- [x] It spanned all 3 horizontal lines | |
-- [x] It spanned all 3 vertical | |
-- [x] It started downward (may have come back up) | |
-- [x] You can't use the same node twice and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SwipeCodes where | |
import Data.List | |
-- [x] Between 5 to 8 "digits" | |
-- [x] At least 1 horizontal line was filled | |
-- [x] It spanned all 3 horizontal lines | |
-- [x] It spanned all 3 vertical | |
-- [x] It started downward (may have come back up) | |
-- [x] You can't use the same node twice and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE NoImplicitPrelude #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
module Lambda.Parser where | |
import Viper.Prelude | |
import Data.Attoparsec.Text | |
import Data.Eq.Deriving ( deriveEq1 ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
property running : False | |
property checkInterval : 30 | |
on run | |
tell application "System Events" | |
if (exists application process "zoom.us") then | |
running = True | |
end if | |
end tell | |
end run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main = interact $ show . f . map (map read . words) . lines | |
f :: [[Int]] -> Int | |
f ([n]:xs:_) | |
| isArith xs = nthArith n xs | |
| otherwise = nthGeom n xs | |
isArith :: [Int] -> Bool | |
isArith (a:b:c:_) = b - a == c - b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main = interact $ show . f . map read . words | |
f (n:a:b:c:_) | |
| b - a == c - b = arith !! n | |
| otherwise = geo !! n | |
where | |
arith = [a, b ..] | |
geo = if diffsigns || increasing | |
then a:map (*d) geo | |
else a:map (`div` e) geo |