Code review - refactoring terminal.py

Some of this stuff is probably too cutesy for you, but there're all changes I think you should consider. Let me know if you'd like to walk through the commits with me. I'd suggest against just merging the edits, choosing the ones you like and reimplementing them or git cherry-picking them if you prefer would be better.

It seemed like treegames.py wasn't working in the original version, so I left it alone except to update it with a small number of api and formatting changes. Let me know if you'd like to look at it later, or want help fixing it.