Nothing to write

One of these days, I feel like I have nothing to write on my blog. Every day, things just happen to be quite the same. The lecturers just keep on teaching new chapters day by day. I take the bus to my campus from 9AM and back home at around 5PM. Whenever there's no more class for the day, I'll be hanging out in the Internet room and surf some web sites. For the whole week, my classmates and I will be busy to finish up our experiment reports and assignments before dateline.

Hmm.. now I understand why some university students don't have blogs. Even if they have one, it wouldn't be updated much often, like mine for example. Even if they update it often, the blog entries wouldn't be lengthy, or contain at least 3 paragraphs. Even though this is my personal blog, I don't write much about that small things that happen in my life. I don't blog about the ridiculous canteen food, the weird air conditioning system in my campus or my course mates' funny jokes. Besides, I take quite some time to write an entry as I need to make sure that my grammar is okay and my language is easily understandable. Generally, my weblog serves as a web platform for me to publish my own articles, opinions and experiments. That's all.

Before this, I use to spend some time on stuff other than my school homework. This is how I manage to learn HTML and CSS when I was in Form 4. Now, the situation is a little different. For the past few weeks, my mind is fully focused on a computer programming language called 'C'. I realised that my programming skills aren't so bad after all, though C seems to be quite harder than PHP. I have converted myself from a PHP beginner to a C beginner. Cool.

And don't worry, I do have few code examples to share, so here's one I like:

/* Calculate pi value */
#include <stdio.h>
#include <math.h>

int main(void)
{
    unsigned long limit, i;
    long double series = 0, pi;
    double percentage, prev_percentage = -1;

    printf("Enter the limit: ");
    scanf("%d", &limit);

    printf("Please wait... ");

    for ( i=1 ; i<=limit ; i++)
    {
        series += 1.0/(pow(i,2.0));
        /* calculate percentage */
        percentage = (double) i/limit*100;
        /* only print percentage when needed */
        if ( (int) percentage > (int) prev_percentage )
            printf("%3.f%%\b\b\b\b", percentage);
        prev_percentage = percentage;
    }

    /* calculate pi */
    pi = sqrt(6*series);

    printf("Completed\npi = %lf\n", pi);

    return 0;
}

I've also coded a simple two-player number guessing game, for everyone's pleasure:

/* Two-player number guessing game */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define MIN_NUM 0
#define MAX_NUM 100

int main(void)
{
    int i, j, rand_num, guess_num, min_num, max_num;
    char play;

    do {
        /* initialise min and max num */
        min_num = MIN_NUM;
        max_num = MAX_NUM;

        /* generate random number */
        srand(time(NULL));
        rand_num = rand() % (max_num+1);

        /* instructions */
        printf("\\tThis game requires two players.\n");
        printf("\\tEach player have to guess a number between %d and %d.\n", min_num, max_num);
        printf("\\tThe player who got it wins the game.\n");

        i = 0;
        do {
            /* switch both players */
            if ( i % 2 == 1 )
                j = 2; /* odd i */
            else
                j = 1; /* even i */

            /* display which player */
            printf("\n");
            if ( j == 2 ) printf("\\t");
            printf("Player %d\n", j);

            /* input guess number */
            do {
                if ( j == 2 ) printf("\\t");
                printf("Enter your guess: ");
                scanf("%d", &guess_num);
                if ( guess_num <= min_num || guess_num >= max_num )
                {
                    if ( j == 2 ) printf("\\t");
                    printf("\\tYou should guess a number between %d and %d!\n", min_num, max_num);
                }
            }
            while( guess_num <= min_num || guess_num >= max_num );

            /* re-assign min and max number */
            if ( guess_num > rand_num )
                max_num = guess_num;
            else if ( guess_num < rand_num )
                min_num = guess_num;
            else
                break;

            /* display range of numbers available */
            if ( j == 2 ) printf("\\t");
            printf("Range: %d - %d\n", min_num, max_num);

            i++;
        }
        while( guess_num > rand_num || guess_num < rand_num );

        /* determine the winner */
        printf("\n");
        if ( j == 2 ) printf("\\t");
        printf("Player %d is the winner! Yeah!!!\n\n", j);

        /* ask wanna play again? */
        printf("Wanna play again (Y for yes) ? ");
        fflush(stdin);
        scanf("%c", &play);

        /* clear the screen */
        if ( play == 'Y' || play == 'y' )
            system("cls");
    }
    while( play == 'Y' || play == 'y' );

    return 0;
}

Please note that my codes are not perfect. Ignoring them is optional.

Due to this fact, it has been a long time I haven't focus on XHTML, CSS, PHP, icons design and theme design. I might not be able to participate in CSS Reboot Fall 2005 this time. As the release of Mozilla Firefox 1.5 is just around the corner, I really doubt if I could update my Phoenity theme in time. Sigh, so many work, yet so little time.