Classwork 13: Animated ASCII Art, Revisited

Objectives

To practice using for loops and to play with printing to the terminal screen.

Assignment

In Classwork 5, we played with printing escape sequences to the screen, which allowed us to "animate" and inch worm crawling across the screen.

In lecture, we saw how this program can be shortened using for loops and functions. Your assignment is to extend the "animation" so the inch worm continues to crawl across the screen after eating the food pellet. The inch worm should leave a trail of . characters (periods) behind for 20 steps. (See demo in this movie clip: eat2.avi.)

You should use inch4.c as a starting point. This already shows the inch worm eating the food pellet.

Notes

Submitting

Don't bother with the script command for this assignment since it doesn't record the pauses from usleep() so the output won't have the desired effect. Just submit your C source code:

submit cs104_chang cw13 inchworm.c


Be sure to logout completely when you have finished!