Friday, May 8, 2015

Thoughts and actions

The routine shores are hard wired in brain that they happen almost without realization of they being done. About non-routine actions the origin is first in thought of doing it and it gets done with some soft wiring.
Yesterday watched a video that dealt with function of brain and electric impulses in movement of body parts. Here is the thought provoking video:
               Ted Neuroscience video
Even if we are free of the electric wiring as depicted in this video we are largely driven by our thoughts and habits.
Doing thought digestion is really very important part of our existence and actions.

Sunday, May 3, 2015

The one rupee snack


Encountered this wonderful snack which comes in the shapes of animals and objects. Eating it with my son is not only fun, it is also learning animals and objects. And guess what it just costs rupee one. Its a very powerful innovation at the bottom of pyramid.
The 7g snack is made by Isha foods, Nagawara main road, Bangalore. Very wonderful innovation. Need more of such disruptive products elsewhere.

Saturday, February 16, 2013

Genesis of political arrogance

Recently, there have been increasing behaviors in Indian politics that only smell arrogance. Most probably its the case that the general behavior of a politician is captured by cameras by chance. Where does this arrogance come from and how is it for the governance?

Over assessment of self worth:
   It originates from the feeling of insulation from wrong doings catching up, from the confidence in ability to tweak reality by virtue of money and power to influence perceptions and divert attentions into confusion, also from being surrounded by agreeing advisers, security guards, convoy of vehicles.

Inability to handle criticism or divergent views:
  The natural consequence is superiority complex. That sees everyone else worthless and any criticism constructive or otherwise irritating. And any event that tests patience turns into a outburst.

How is it for governance?
  Governance that is based on singular views and is inflexible for correcting its course based on constructive criticism or the need of the times or long term vision is doomed. In democracy, if such a government refuses to correct its course, is without doubt diving into political irrelevance.

Wednesday, November 7, 2012

Fluid automata




These are armature  videos to demonstrate a simple idea regarding energy efficient fluid transport.
It revolves around the observation that if an airtight pipe is used then water flows without energy as long as start point holds an higher level of water than the exit. The twists and turns or the elevation of the pipe in between do not matter. 

Sunday, August 5, 2012

A naturalist's dilemma

We hear a lot of voices carrying an argument that things not being good for us as these are not directly available in nature and hence opposed to our natural well being. This argument if applied in totality makes the whole human endavours over centuries and millaniums a war against the nature. Which is flawed.
Being foremost thinking creatures we have the advantage and responsibility. Sustainability for ourselves and the surroundings; living and the complimentry needs to be thought to the best of the comprehension. Any cynical approch in either direction can only be undoing of the endavours.

Saturday, August 4, 2012

The last satyamev jayate episode

Let me first admit that i am a big fan of the   series. It has had an impact that is far greater than the sum  total of indian news channel  debates in recent years. 
I liked the story of the villager who single handedly  paved a way across a mountain. I feel it has a great lesson for the anna movement and  citizens frustated of the system.
A single  man's determination can move a mounntain; with so many good  people around system is bound to  channge; save a bit determination.

Wednesday, November 2, 2011

C Program to solve a 9*9 Sudoku


Here is a program that I wrote to solve Sudoku sometime back. Posting on the blog now.

#include

int show_sudoku();

static int sudoku_nos[9][9]= {
{3,0,5,4,0,1,6,0,2},
{0,0,0,0,0,0,0,5,1},
{6,0,0,0,0,9,7,0,0},
{0,0,0,0,0,0,0,0,4},
{0,0,0,6,4,5,0,0,9},
{4,3,7,0,0,8,2,0,5},
{0,0,0,0,6,2,0,0,0},
{0,5,4,0,1,0,0,8,6},
{8,7,0,0,5,0,1,2,0}
};

static short int vals_g[]={1,2,3,4,5,6,7,8,9};
static short int others_options[]={1,2,3,4,5,6,7,8,9};

int show_possiblities(int i, int j,short int vals[])
{
int m=0,n=0,count=9,udi=0;
for(m=0;m<9;m++)
{
if(sudoku_nos[i][m]!=0)
{
vals[sudoku_nos[i][m]-1]=0;
count--;
}
}
for(m=0;m<9;m++)
{
if((sudoku_nos[m][j]!=0)&& vals[sudoku_nos[m][j]-1]!=0)
{
vals[sudoku_nos[m][j]-1]=0;
count--;
}
}
for(m=(i-(i%3));m<((i-(i%3))+3);m++)
{
   for(n=(j-(j%3));n<((j-(j%3))+3);n++)
{
if((sudoku_nos[m][n]!=0)&& vals[sudoku_nos[m][n]-1]!=0)
{
vals[sudoku_nos[m][n]-1]=0;
count--;
}
}
}
return count;
}

void check_others_options(int i, int j,short int vals_o[])
{
int m=0,n=0,count;
for(m=(i-(i%3));m<((i-(i%3))+3);m++)
{
  for(n=(j-(j%3));n<((j-(j%3))+3);n++)
{
if(i!=m&&j!=n&&sudoku_nos[m][n]==0)
{
count=show_possiblities(m,n,vals_o);
if((sudoku_nos[m][n]!=0)&& vals_o[sudoku_nos[m][n]-1]!=0)
{
vals_o[sudoku_nos[m][n]-1]=0;
}
}
}
}
}

void solve_sudoku()
{
int i,j,count,count_o,m,k=0,r=0,udi=0,x=0,y=0,xx,yy,dd,d,z;

    while(true)
{
k=0;
for(i=0;i<9;i++)
{
printf("\n");
for(j=0;j<9;j++)
{
if(sudoku_nos[i][j]==0)
{
k=1;
for(m=0;m<9;m++)
{
vals_g[m] = m+1;
others_options[m]=m+1;
}
count=show_possiblities(i,j,vals_g);
check_others_options(i,j,others_options);
if(count==1)
{
udi=0;
r=0;
    printf("\n%d,%d=",i+1,j+1);
    for(m=0;m<9;m++)
{
if(vals_g[m]!=0)
{
printf("%d",vals_g[m]);
sudoku_nos[i][j]=vals_g[m];
show_sudoku();
printf("\n");
}
}
}
else if(r>80&&count<3)
{ x=0;y=0,d=0;
for(m=0;m<9;m++)
{
if(vals_g[m]!=0)
{
if(x!=0)x=vals_g[m];
else
if(y!=0)y=vals_g[m];
else
d=vals_g[m];
}
}
xx=0;yy=0;//dd=0;
for(z=0;z<9;z++)
{
if(x==others_options[z]) xx=10;
if(y==others_options[z]) yy=10;
//if(d==others_options[z]) dd=10;
}
if(yy!=10 && (xx==10 && dd==10)){ sudoku_nos[i][j]=yy; udi=0; r=0; printf("\n%d,%d=%d",i+1,j+1,yy);}
if(xx!=10 && (yy==10 && dd==10)){ sudoku_nos[i][j]=xx; udi=0; r=0; printf("\n%d,%d=%d",i+1,j+1,xx);}
//if(dd!=10 && (yy==10 && xx==10)){ sudoku_nos[i][j]=dd; udi=0; r=0; printf("\n%d,%d=%d",i+1,j+1,dd);}
if(r!=0){
show_sudoku();
printf("\n%d options for %d,%d:",count,i,j);
for(m=0;m<9;m++)
{
if(vals_g[m]!=0)
printf("%d ",vals_g[m]);
}
printf("\nUdi mara: ");
scanf("%d",&udi);
if(udi<9&&udi>0)sudoku_nos[i][j]=udi;
udi=0; r=0;
}
}
}
}
}
if(k==0) break;
r++;
}
}


int show_sudoku()
{
int i=0,j=0;
for(i=0;i<9;i++)
{
printf("\n");
for(j=0;j<9;j++)
{
if(sudoku_nos[i][j]<=0||sudoku_nos[i][j]>9)
printf(" * ");
else
printf(" %d ", sudoku_nos[i][j]);
}
}
return 0;
}

int main()
{
//check & solve
    solve_sudoku();
    //Print the input
show_sudoku();
printf("\n");
getchar();
return 0;
}