

Ask HN: Is writing text-based games a good introduction to programming? - seagreen


======
tikhonj
The very first CS class I took in college was based on SICP (taught in Scheme,
for reference). By this point, I had already been programming for a while, but
there were plenty of students with very limited exposure to programming as
well.

One of the projects we had was writing a text-based RPG. This was to highlight
the ideas behind OOP, which we learned _after_ functional programming.
Initially, the idea seemed to have merit--writing a game seemed to be a fun
thing to do. However, I got quickly bogged down in boring detail; it turned
out that writing a text based game has a lot of boring, repetitive work for
each of the cool bits. It was the most tedious project in the class overall.

The final project we did was implementing a Logo interpreter. This was
completely different--the ratio of cool and insightful stuff to boring fiddly
bits was much, much better. Also, unlike the text-based game, even a barely
working final result felt brilliant. Being able to program in a language I had
just implemented was magical. Playing a text-based game with a working engine
but a poor story line did not measure up.

So far, this has been my favorite course. However, I remember the text-based
game as annoying and not particularly illuminating; it does not compare at all
with the logo interpreter.

Overall, I think that too much of a text-based game is repetitive and boring,
and it relies too much on non-programming bits (the dialog, the setting, the
story) to be consistently inspiring to a new programmer.

~~~
seagreen
Thanks, that's really helpful. Though at my current level of ability a text
based game is plenty challenging:)

------
pekk
If you like text-based games, it is a good introduction.

Otherwise, only really tiny self-contained examples are good. You need to
break it down into more 'atomic' pieces - at which point you are no longer
developing a text game.

You could use a really trivial VERB NOUN parser instead of the usual RPN
calculator example. You can use a directed-graph world as a showcase for
linked lists. TCP is often learned by writing a simple chat server.

Higher-level languages might make it easier to constrain this sort of project
to a few hours.

But most people do not like text games and doing a proper job is probably an
order of magnitude more complex than you imagine it to be. So actually writing
or modifying a text game is only a great idea if it is motivating to the
learner.

------
drcode
I would say "yes" if you're learning a language that has a REPL (such as the
Lisp languages.) A REPL is already basically an interface for a text-based
game and learning about one helps you learn about the other.

That's why I create a text adventure game in "Land of Lisp" and on my website:
<http://lisperati.com/casting.html>

~~~
seagreen
That's awesome. Thanks very much.

------
TheCowboy
<http://learnpythonthehardway.org/>

This book takes takes this approach with a number of its examples and
projects.

And I think the book is a good introduction to programming and Python.

