Random C Stuff.

While browing through comp.lang.c found this interesting discussion.



/* Without using /, % or * operator, write a function to divide a number by 3.
* */
#include

int divideby3(int);

int main(int argc,char **argv)
{
int res;
res = divideby3(9);
printf("%d",res);
return 0;
}

int divideby3(int aNumber)
{
div_t d = div(aNumber, 3);
return d.quot;
}



Never have explored the capablities of stdlib. Infact, with C Programming
Language out of touch for so many months, I was thinking this program will
seriously fail, thinking kind of how come div_t datatype, d.quote
(object.property ?) etc. gcc will crib saying dont using c++. But it worked
perfectly fine.

N-Puzzle Problem solver using Python

Completed and submitted my project "N-Puzzle problem solver". Wrote it in Python programming language and it was good fun. Learned about the similarities of lisp and python. Why lisp is so powerful and how easy things will become once you get a hang of the language called Python.
Solving the N-Puzzle problem, I had tried without any base algorithms and it was damn hard to derive any solution. Once I saw the problem solving strategy using Manhattan Distances at norvig 's site. Coding the solution was enjoyable. You get a feel of what AI problems are when trying these Toy-AI problems.