Monday, June 27, 2005

The Su-Doku solver improved

I improved the Su-Doku solver by adding some recursion and backtracking. It can now handle the really ugly puzzles which require backtracking. It can also solve ambiguous puzzles which can have more than one solutions. I am proud of it :)

Sunday, June 26, 2005

A nice busy day.

I woke up to rain today :) which was a nice change after so much of heat. I had to go pick up Dad from New Delhi railway station in the morning. So I got to take out the car and go all the way till there, with mom. Dad's train was around half an hour late due to the rains. We had an "extended breakfast" at some restaurant in CP and then left for Lajpat Nagar to do some shopping. I got myself some shorts and t-shirts. Mom ended up buying a salwar suit for Rs 1,399 because when she saw the price tag she though that it was only Rs 399. We reached back home at around 2pm. I had my Lunch and left for Center Stage Mall (Noida) with my friend Rakesh to watch "Kung-Fu Hustle". It was not too great, the stunts were good but no story as such. After that we went to Superstars. It was pretty nice.

Friday, June 24, 2005

Su-Doku Solver

I was first introduced to Su-Doku a few days back by my friends Sujit and Addy. It was a daily feature in one of the newspapers: The Hindu. It is a placement puzzle and each puzzle could have only one solution. I could do the puzzles but it took me around 1/2 an hour to finish them. Now, this is good if you want to kill time and it helped me during the long tiring train journey from Cochin to Delhi in June 2005. On the train I was wondering that it would be pretty easy to write a program which solves the puzzle.


When I reached Delhi I started learning Python, mainly because the language intrigued me and there were a lot of people ( Eric. S. Raymond and Bruce Eckel to name a few ) had given it a thumbs up. Now it has been around 3 days since I started learning it and I must say it is a beautiful language in it's own rights.


So, I wrote a Su-Doku puzzle solver today in the evening of 24th June because it was too hot outside and I wanted to learn python.


Here is the python code. I have just used two test cases for it, which can be found here and here.

[update 25th June] The solver is in fact broken. I guess I should have used more test cases. It solves easy puzzles but gets stuck in some of the medium to hard puzzles. I will try to get it working for them also.

[update 25th June]Took care of the problem. Now it is solving the hard and medium puzzles also. I will feed it some more test cases before announcing success.

Thursday, June 23, 2005

Rahul's PC

Rahul's PC
Rahul's PC,
originally uploaded by [Rohit].
The cabinet has a giant fan inside which can be seen throught the window and imported blue case lights. The car on top of the monitor is a scaled replica of a Nissan Skyline. The other frills are: a wireless mouse, a bluetooth thingie, altec speakers and a nice graphics card.

Wednesday, June 22, 2005

Delhi heat

So the days are passing by without me getting too bored. I go and play basketball early in the morning at our school. Sleep or try to learn a bit of python in the afternoon. Evenings are again for excursions outside the house with friends. Thats about it.

Sunday, June 19, 2005

Back at Delhi

I reached Delhi yesterday evening. The train journey was pretty tiresome due to the heat. Temperatures here are soaring. I got to meet most of my "old school" friends yesterday itself. I will have to book my return tickets fast as they too are drying up in the heat (whatever).

Wednesday, June 15, 2005

Exams over once again..

I finished up my 6th semester exams today. Today's exam (control systems) was not that great though. The paper was tough and I made some silly mistakes :( .
I leave for Delhi tomorrow. I hope to have some fun there although I don't have too much time ( The college reopens on 1st July *damn* ).

Monday, June 13, 2005

Last one..

I had my Microprocessor exam today. It went ok. I got soaked in the rain while coming back. The last and final exam is Control Systems Engineering two days from now. I just hope it goes of well. Then I am of to Delhi the next day.

Saturday, June 11, 2005

Nearing the end..

of another semester exam and you get the same feeling all over again. Yep, not in the mood to study. Two more exams to go. When will wednesday come??

Wednesday, June 08, 2005

An AJAX hack gone bad...

The latest buzz over the web these days is AJAX aka XMLHttpRequest . I thought I should at least try to find out what it is, so I somehow managed to dig up this site . There are two files client.html and server.php which demostrate AJAX. Now what is interesting to note is, that the "server" need not be a PHP etc file as long as what it spews out is XML.
I thought this can be used to somehow serve content remotely. Suppose you have a web site and are running short of storage space, which is obviously expensive. What you could do is store your HTML document in an encoded format in one of the free web hosts found over the web and use XMLHttpRequest to fetch the page for you. Thus you don't need to worry about the ads of the free web hosting site (ads are placed on HTML documents and we will be using a text file).
The encoding could be the one like which we have at osix, meaning using a '[' and ']' instead of a '<' and '>' for html tags.
For an example check this

The client will request for the document using AJAX and then parse it, basically replacing each '[' and ']' with a '<' and '>' and then display the page by (maybe) using document.write .

It looked to me that it will work and it even did when I tried it locally on my PC. But unfortunately when I try to do it over the internet it doesn't work. In my case I uploaded the client over at geocities and the server (the document which has to be served, rather) here at osix. But when I run the client nothing happens. Is it because the request is coming from another domain name ? If I keep both the client and server in the same directory at geocities it works.

Anyone know what is going wrong. Is, what I am trying to do even possible??

Monday, June 06, 2005

Random thoughts

I have my Operating Systems exam tomorrow. Although it is not a tough paper, the amount of stuff we have to study is quite extensive. Hope it goes well..
I wrote another article. I guess I am getting a bit bored of all the exams, even though only one is over.
Slashdot had an article about a guy making a home brewn CPU. Pretty cool.

Saturday, June 04, 2005

Pi

So, Rahul was telling me about Super PI a few days back, it basically allows you to calculate the value of PI upto a really large amount of precision. On my machine (Athlon XP 2000 + with 256 Megs of RAM) it took 1 min 26 seconds to calculate till 1 million (it can calculate upto 32 million max). Here is what is looks like.

Thursday, June 02, 2005

Summer of code??

Google announced the summer of code a few days back. I would like to participate but I don’t know if I am upto the mark and with exams going on I really don’t know if I will be able to churn up any good ideas for a project.

Exams started

My exams have begun. Today it was DSP for me. The exam went fine for me. The EC guys got screwed as they had a relatively tough paper. Next exam is OS on 7th. I will start studying for that in a few days... (hopefully).