Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search

20. Just For Fun !!!

This section contains few programs written by me just for fun. They don't signify a better programming practice or the best way of using ncurses. They are provided here so as to allow beginners to get ideas and add more programs to this section. If you have written a couple of nice, simple programs in curses and want them to included here, contact me.

20.1. The Game of Life

Game of life is a wonder of math. In Paul Callahan's words

The Game of Life (or simply Life) is not a game in the conventional sense. There
are no players, and no winning or losing. Once the "pieces" are placed in the
starting position, the rules determine everything that happens later.
Nevertheless, Life is full of surprises! In most cases, it is impossible to look
at a starting position (or pattern) and see what will happen in the future. The
only way to find out is to follow the rules of the game.

This program starts with a simple inverted U pattern and shows how wonderful life works. There is a lot of room for improvement in the program. You can let the user enter pattern of his choice or even take input from a file. You can also change rules and play with a lot of variations. Search on google for interesting information on game of life.

File Path: JustForFun/life.c

20.2. Magic Square

Magic Square, another wonder of math, is very simple to understand but very difficult to make. In a magic square sum of the numbers in each row, each column is equal. Even diagnol sum can be equal. There are many variations which have special properties.

This program creates a simple magic square of odd order.

File Path: JustForFun/magic.c

20.3. Towers of Hanoi

The famous towers of hanoi solver. The aim of the game is to move the disks on the first peg to last peg, using middle peg as a temporary stay. The catch is not to place a larger disk over a small disk at any time.

File Path: JustForFun/hanoi.c

20.4. Queens Puzzle

The objective of the famous N-Queen puzzle is to put N queens on a N X N chess board without attacking each other.

This program solves it with a simple backtracking technique.

File Path: JustForFun/queens.c

20.5. Shuffle

A fun game, if you have time to kill.

File Path: JustForFun/shuffle.c

20.6. Typing Tutor

A simple typing tutor, I created more out of need than for ease of use. If you know how to put your fingers correctly on the keyboard, but lack practice, this can be helpful.

File Path: JustForFun/tt.c