A little more thought led to this solution, although it's not terribly effecient, so I would still appreciate any better ideas...
(I have not tested it yet, either, so there may be a bug or two)
PHP Code:
// This is just a C code "fragment"...
int row=0, col=0, greatestValue=0, pickerFlag=0, random=0, rowChoice=0, colChoice=0;
int picker[3][3]={{0,0,0},{0,0,0},{0,0,0}};
srand(time(NULL));
for(row=0; row<=2; row++)
{
for(col=0; col<=2; col++)
{
picker[row][col]=myArray[row][col];
}
}
do
{
pickerFlag=0;
for(row=0; row<=2; row++)
{
for(col=0; col<=2; col++)
{
if(picker[row][col]>greatestValue)
{
greatestValue=picker[row][col];
rowChoice=row;
colChoice=col;
}
else if(myArray[row][col]=greatestValue
{
pickerFlag=1;
}
}
}
if(pickerFlag==1)
{
for(row=0; row<=2; row++)
{
for(col=0; col <=2, col++)
{
if(picker[row][col]==greatestValue)
{
random=rand();
picker[row][col]=random;
}
else
{
picker[row][col]=0;
}
}
}
}
} while(pickerFlag==1);
// Program continues...
Can you see what I am doing here, and, more importantly, help me improve it? Completely different ideas would be good too. Meanwhile, I'll continue building my app using the code above.
Andrew