Monday, May 12, 2008

Do you still love your old snake game?

With the development in graphics hardware and computing power, the games developed these days are very powerful and challenging. But still there is something fascinating about the traditional computer games. Most of us have must have played snake game popular on cell phones. I am sure there are many who are very crazy about it. I am myself a fan of the game and I love the simplicity of the game. But as far as I believe, after a certain time you adapt to the game and get hold of timings and strategy which may dilute your enthusiasm after sometime. And there is really no time factor for eating the food. How about being able to limit the time within which a player must eat the food? Hmmm.. not convinced with the idea.

Ok how about adding a timing limit indirectly by making you compete for a food which your friend in network also tend to occupy. That is making it go multi-player. Ah, now that sounds interesting. Want some more challenge? How about an intelligent snake which the computer controls and which is capable of determining the shortest path to food? Scared? Ain't you excited about it? Yup, there is a game that adds these feature to the snake game-iSnake. The project has been developed in Java. And just to let you know I am one of the developers of the game.

We developed this game as a part of our academic project and with the purpose of research in AI and real time gaming. But that doesn't mean we ignored factors like smooth gaming experience. We twicked the original swing components in Java to give the GUI a game like touch. The project uses Apache Mina Framework for communication. Besides, the game uses an algorithm for shortest path finding which we developed ourselves. The biggest challenge in the project was path computation in real time. Each game cycle is of 100ms and computing path within 100ms with other threads simultaneously running is really tough. Most of the path computations are rarely done in real time. We code- named the algorithm that we are currently using in the game as Viper. The game won the first prize at 'KUCC Software Meet 2008' and we participated with the project in 'LOCUS-Technical Fest 2008' for which the results are still awaited.

The game is hosted at sourceforge.net and has been released on 07 May. The game is registered under GPL and can be launched from web page using Java Webstart. You can find the complete documentation of the project including the path finding algorithm on the website.

So what are you waiting for? Browse the url: http://isnake.sourceforge.net, download the game. And get going. Give your friends a difficult time eating food. Happy Gaming!!!

Saturday, December 22, 2007

Extracting email addresses from multiple files

Few days back, we conducted a LTSP (Linux Terminal Server Project) ToT (Training of Trainers). We invited application (a .txt format) for the training. We needed 25 applications but we had around 90.
Now sending notification to everyone about their selection status was a problem. One option was to open the .txt file one by one then copy and paste the email address which was way too manual and time consuming (not less than 2 hours). Hence, we thought of an alternative.

I placed all the .txt files in a folder 'application'. Then I extracted out the lines that contained email addresses. The following simple yet powerful command did this for me.

jitendra@jitendra:~/application$ cat *.* | grep '@' > email_lines


cat *.* concatenated all the files in the directory and grep extracted the lines containing @. The output was directed to a file email_lines. The output contained lines like the one shown below:
(g) Email address: abc@gef.com

Though this command was sufficient to simplify out task and I could have done with it with more 15 minutes processing. But I wanted to go further experimenting and making the task more simple.

Now what I wanted was the section only after : from each line. This was accomplished using cut command. I went about like this.

jitendra@jitendra:~/application$ cut -d: -f2 email_lines>email_list

cut command remove the sections from each line of files. Here -d defined : to be the delimiter. -f was used to select the field. 2 specifies the field to the right of the delimiter : . 1 would have specified field to the left of delimiter. email_lines is the file from which the field section has to be removed. I directed the output to email_list.

Now I had a list of email addresses only. I preferred adding comma manually to them to create a comma separated list of email-addresses to send the notification.

The task which would have otherwise taken more than 2 hours was over in less than 10 minutes.

Sunday, November 18, 2007

GMail: Bigger and better

Only days after welcome improvements in UI and functionalities with new additions, GMail has now increased the mailbox volume to around 5000 MB mark.
The change comes in less than a month after GMail raised its mail size from around 2800 MB to 4300 MB.

With this, GMail makes it clear that size is never going to be a barrier in using GMail. Before you reach anywhere near the limit, you will get your mailbox size enlarged.

The improvements in UI are really a welcome change. Though the changes seem small, but I feel most of them are really awesome. Though I have not much explored the changes because of lack of time, the ones I liked are:

  • The new color selection looks better than the previous one. Though the change in color appear only at few places.
  • The change in position of Loading status display was long awaited. The previous design used to hide the Sign Out link in case of Loading.
  • The contact info on mouse-hover is really a great feature.
With these additions, GMail has shown that nothing can beat Google when it comes to innovation and quality.

Saturday, October 27, 2007

Brand your Site with Favicon

Want to give your website a professional look? Want it to be distinctly identified among others? Static and animated favicons, can work for you.

A favicon (short for 'favorites icon'), is an icon associated with a particular website and is displayed in URL bar, in the list of bookmarks and next to page title in tab-enabled browsers in a favicon enabled browser. Basically, favicon is a 16x16 pixel icon. 16x16 pixel is too small size but it can contain something really meaningful and attractive.

While Internet Explorer supports only .ico format, Firefox, Opera, Flock, etc support .png and .gif as well. So, if you are using static favicon, it is advisible to go with .ico file to have support for all browsers.
Firefox has even added support for animated .gif files. It won't be a big surprise if other browsers also add support for them in their new releases.

To have one on your webpage, go through the following steps:
  1. Create a 16x16 or 32x32 pixel ico/gif/png file and name it "favicon.xxx" where xxx is suitable extension.
  2. Include the following tag in the head element of the webpage if you are using .ico image.
    • <link rel="shortcut icon" href="favicon.ico">
  3. If you are using .png or .gif image, use the following tag instead
    • <link rel="shortcut icon" href="favicon.xxx" type="image/xxx"> where xxx is proper file type (gif/png).
With this you are ready with one on your page.

N.B.: GIMP can be used to create .ico image. And if you are looking for creating an animated gif image using GIMP, you can find a good tutorial to start with at http://www.novell.com/coolsolutions/feature/1664.html