Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //movement upwards
- for (i=0;i<h;i++){
- for (j=0;j<b;j++){
- if(mapa[i][j]==help){
- aux=mapa[i-1][j];
- mapa[i-1][j]=mapa[i][j];
- mapa[i][j]=aux;
- break;
- break;
- }
- }
- }
- //movement to the left
- for (i=0;i<h;i++){
- for (j=0;j<b;j++){
- if(mapa[i][j]==help){
- aux=mapa[i][j-1];
- mapa[i][j-1]=mapa[i][j];
- mapa[i][j]=aux;
- break;
- break;
- }
- }
- }
- //movement to the right
- for (i=0;i<h;i++){
- for (j=0;j<b;j++){
- if(mapa[i][j]==help){
- aux=mapa[i][j+1];
- mapa[i][j+1]=mapa[i][j];
- mapa[i][j]=aux;
- break;
- break;
- }
- }
- }
- for (i=0;i<h;i++){
- for (j=0;j<b;j++){
- if(mapa[i][j]==help){
- aux=mapa[i+1][j];
- mapa[i+1][j]=mapa[i][j];
- mapa[i][j]=aux;
- break;
- break;
- }
- }
- }
Add Comment
Please, Sign In to add comment