Using Curses

Curses is a standard unix library; you can expect it to be available on all unix systems. It gives you a slightly convenient-ish way to control the terminal and its cursor. It also works fairly well. Unfortunately, curses doesn't provide every possible function you could ever want. Ncurses is an extended version of curses. You won't find it on quite every unix system, and it has a few bugs, but it's just about exactly what we want.

This link is to a downloadable, ready to compile program, called curses.cpp that demonstrates the basic functions, creating windows and stuff. It generates a random, not-very-well planned world for a creature to roam around in, and it also creates a little creature that roams around. The creature makes no pretense at intelligence, it has completely random brownian motion, but the prupose of this program is to demonstrate hwo to handle the screen properly, not to do your homework for you.

If you download the program into a file called curses.cpp, you compile it like this:
        CC -c curses.cpp
then you link it like this:
        CC -lncurses curses.o
then run it in the normal way:
        ./a.out


Read the comment at the beginning of the file for more information.