Here are some programmes I've written to comprehend different concepts of computer sciences, to practise, or to make ones life easier. Please excuse the bad design and dilettantish approach of them. They represent my first steps towards programming and probably do not demonstrate good coding practices. ;-)
Legal
All programmes are distributed under the terms of the Simplified BSD Licence.
ishappy
Description
This programme determines whether a given number is happy or not. This is done by applying the following routine: Sum up the number's squared digits and repeat this step with its result, until the sequence repeats itself, or returns 1. If latter applies, you've got a happy number.
I used doubly-linked lists here.
ishappy.tgz (4.3 KiB)
Preview
$> ./ishappy -v 7 7 -> 7^2 49 -> 4^2 + 9^2 97 -> 9^2 + 7^2 130 -> 1^2 + 3^2 + 0^2 10 -> 1^2 + 0^2 1 Happy.
easter
Description
This tiny programme calculates the easter date of a given year or a range of years.
easter.c (1.8 KiB)
Preview
$> ./easter 1998 2009 1998-04-12 1999-04-04 2000-04-23 2001-04-15 2002-03-31 2003-04-20 2004-04-11 2005-03-27 2006-04-16 2007-04-08 2008-03-23 2009-04-12
sudoku
Description
A very simple sudoku game for the console. It loads maps at runtime, hence one can create and play own maps.
sudoku.tgz (3.1 KiB)
Preview
$> ./sudoku
Time: 0 sec
Total: 257/405
Score: 0
1 2 3 4 5 6 7 8 9
-------------------------
1 | 5 | 4 9 | 8 |
2 | 1 | 3 7 | 5 |
3 | 7 2 9 | 8 6 5 | 1 4 3 |
-------------------------
4 | 9 1 2 | | 3 7 6 |
5 | 3 | 9 6 | 4 |
6 | 4 8 6 | | 9 5 2 |
-------------------------
7 | 6 5 7 | 9 8 4 | 2 3 1 |
8 | 8 | 6 2 | 7 |
9 | 4 | 7 1 | 6 |
-------------------------
$>