    where
        positions = M.fromList $ zip xs [1 .. length xs]

next :: Game -> Game
next (num, cur, positions) = 
    case M.lookup num positions of
        Nothing -> (0, cur + 1, M.insert num cur positions)
        Just old -> (cur - old, cur + 1, M.insert num cur positions)

part1 :: [Int] -> Int -> Int
part1 xs stop = fst3 $ go (initialize xs)
    where
        go :: Game -> Game
        go game =