|
From: Kenneth C. <ken...@ho...> - 2008-05-09 14:20:30
|
what's wrong with the following code as it is not working.
if (c> dCol && sq[r][c - 1] != '#' && sq[r][c - 1] != ' ') {
if (sq[r][c] == ' ' && sq[r][c + 1] != ' ') {
spmtn1(r, c - 1);
}
}
if (c> dCol && sq[r][c - 1] != '#' && sq[r][c - 1] != ' ') {
if (sq[r][c] == ' ' && sq[r][c + 1] == ' ') {
if ((sq[r][c]>= sq[r][c + 1] && sq[r][c - 1]>= sq[r][c]) || (sq[r][c] <= sq[r][c + 1] && sq[r][c - 1] <= sq[r][c])) {
spmtn1(r, c - 1);
}
}
}
else
if (c < dCol && sq[r][c + 1] != '#' && sq[r][c + 1] != ' ') { -->if this line is false then jump to the next else if, but if it is true
if (sq[r][c] == ' ' && sq[r][c - 1] != ' ') {-->if this line is true then execute the statement, the below if statements won't be executed, but if it is false
spmtn1(r, c + 1);
}
}
if (c < dCol && sq[r][c + 1] != '#' && sq[r][c + 1] != ' ') {-->as this line still remain as true, same first if statement as above
if (sq[r][c] == ' ' && sq[r][c - 1] == ' ') {-->if the above second if statement is false then this line will always be true
if ((sq[r][c]>= sq[r][c - 1] && sq[r][c + 1]>= sq[r][c]) || (sq[r][c] <= sq[r][c - 1] && sq[r][c + 1] <= sq[r][c])) {-->then check this line, if it is true then execute the statement, if it is false then jump to the next else if
spmtn1(r, c + 1);
}
}
}
else
if
_________________________________________________________________
Never miss another e-mail with Hotmail on your mobile.
http://www.livelife.ninemsn.com.au/article.aspx?id=343869
|