Move the problems' logic inside a module to be returned by an IIFE.
Remove the code responisble for fetching the input file.
Assign the result of calling #nextCard to a variable.  Should increase readability.