RFAO3LA5NS6PBYXM2XMFQGSYADRHQ7MBEV5N26IN2YZ22FNG2W4QC
drawCRT :: [(Cycle, RegX)] -> String
drawCRT [] = mempty
drawCRT ((c, x):[]) = foldr' (\a b -> (drawPixel a x) : b) [] [c..240]
drawCRT ((ac, ax):r@(bc, bx):xs) = (foldr' (\a b -> (drawPixel a ax) : b) [] [ac..bc-1]) ++ drawCRT (r:xs)
splitCRTLines :: String -> [String]
splitCRTLines = go
where
go :: String -> [String]
go [] = [[]]
go x = (fst $ crtLine x) : go (snd $ crtLine x)
crtLine = splitAt 40
drawPixel :: Cycle -> RegX -> Char
drawPixel x y
| index <= 1 = '#'
| otherwise = '.'
where
index = abs (column - y)
column = (x - 1) `mod` 40