11.07.2015 Views

Builders guide robot pacman.pdf

Builders guide robot pacman.pdf

Builders guide robot pacman.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

case S:case E:case W:}break;x = current_x_pos - cells_away;y = current_y_pos;break;x = current_x_pos + cells_away;y = current_y_pos;break;x = current_x_pos;y = current_y_pos - cells_away;break;x = current_x_pos;y = current_y_pos + cells_away;break;}}else{}case PACRIGHT:switch( current_orient ){case N:x = current_x_pos + cells_away;y = current_y_pos;break;case S:x = current_x_pos - cells_away;y = current_y_pos;break;case E:x = current_x_pos;y = current_y_pos + cells_away;break;case W:x = current_x_pos;y = current_y_pos - cells_away;break;}break;case PACBACK:switch( current_orient ){case N:x = current_x_pos;y = current_y_pos - cells_away;break;case S:x = current_x_pos;y = current_y_pos + cells_away ;break;case E:x = current_x_pos - cells_away;y = current_y_pos;break;case W:x = current_x_pos + cells_away;y = current_y_pos;break;}break;}random = get_timer1();x = (random/10)%6;y = random%6;// random Pac-Man position estimateshort is_neighbour( int x, int y, direction dir ){int walls;walls = maze[point_to_cell_number(x,y)];if ( dir == N ){if ( walls & NORTH )return 0;elsereturn 1;}else if ( dir == E ){if ( walls & EAST )return 0;elsereturn 1;}else if ( dir == S ){

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!