diff --git a/d8golf.hs b/d8golf.hs index de135ff..32633c0 100644 --- a/d8golf.hs +++ b/d8golf.hs @@ -1,4 +1,4 @@ import Data.List r(p,o)=map(\h->last(h:[p|h==o])) -main=interact$show.((,).sum.map(foldl1$(+).(10*))<*>length.filter(`elem`[1,4,7,8]).concat).map(drop 10.t.filter(/="|").words).lines +main=interact$show.((,).sum.map(foldl1$(+).(10*))<*>length.filter(`elem`[1,4,7,8]).concat).map(drop 10.t.filter(<"|").words).lines t z=head[p|q<-permutations['a'..'g'],Just p<-[mapM((`elemIndex`["012345","12","01346","01236","1256","02356","023456","012","0123456","012356"]).sort.($zip['0'..]q).foldr r)z]]