More card/deck management and base study mode.

Don't trust the last two commits. They won't compile because I left
a half-finished file there...