so i have this board called brdray it has bunnies on it and when one is above the other the program will dynamicaly create a new object, each go they will move randomly.
i have a function called clear board, its uses nested for loops to sweep through brdray and whenever it encounters an f or m it resets the board to x which is a blancspace
its here...it works fine.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
void clearboard (char brdray[10] [10])
{
char x=' ';
char f='f',F='F',m='m',M='M';
for (int a = 0;a<10;a++)
{
for (int b =0;b<10;b++)
{
if ((brdray [a] [b]==f)||(brdray [a][b]==m)||(brdray [a][b] == F)||(brdray[a][b]==M))
{
brdray [a] [b]=x;
}
}
}
}
this is supposed to sweep through in the same way, just that one int that represents the index number is set to - 1, this way if an m is above an f
so..
brdray [1][1]==m and brdray [2][1] ==f will be the argument for the if statement to roll on... so why baint it work?
void makebabies (char brdray[10] [10])
{
char x=' ';
char f='f',F='F',m='m',M='M';
for (int a = 0;a<10;a++)
{
for (int b =0;b<10;b++)
{
char z= '*';
int apos;
int aneg;
int bpos;
int bneg;
apos=a;
apos+1;
if ((brdray [a][b] == f) && (brdray[apos][b]==m))//if f is above m
{
brdray //does its stuff
}
}
}
}
or bellow f or whatver i keep running the board in lota of different combinations
void makebabies (char brdray[10] [10])
{
char x=' ';
char f='f',F='F',m='m',M='M';
for (int a = 0;a<10;a++)
{
for (int b =0;b<10;b++)
{
char z= '*';
int apos;
int aneg;
int bpos;
int bneg;
apos=a;
apos+1;
if ((brdray [a][b] == f)==(brdray[a][b]==f) )//if f is above m
{
brdray [a] [b] = z;
}
}
}
}
well that was dumb, i tried EVERYTHING and my basic stuff was weak...still i cant suss out why some things had occured but now i can experiment...cheers guys that musve been to easy for you, i will come across a hard one soon enuff