Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* set value of the surrounding 8 grids until there's no changes */
- while (change != 0){
- change = 0;
- for(j=world->y_siz-1; j>=0; j--){
- for (i=0;i<=world->x_siz;i++){
- //for(i=0;i<world->x_siz;i++){
- //for(j=0;j<world->y_siz;j++){
- /*1*/
- if (((world->grid[i+1][j]) == OBSTACLE)||(i+1>world->x_siz-1)){
- /*do nothing*/
- }else{
- if ((world->grid[i+1][j] == UNKNOWN)&&(world->grid[i][j]==0)){
- world->grid[i+1][j] = world->grid[i][j] + 2;
- change = 1;
- }
- else if ((world->grid[i+1][j] != UNKNOWN) &&(world->grid[i+1][j]>world->grid[i][j]+2)){
- world->grid[i+1][j] = world->grid[i][j] + 2;
- change = 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement