Guest User

Untitled

a guest
Apr 25th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. //movement upwards
  2. for (i=0;i<h;i++){
  3. for (j=0;j<b;j++){
  4. if(mapa[i][j]==help){
  5. aux=mapa[i-1][j];
  6. mapa[i-1][j]=mapa[i][j];
  7. mapa[i][j]=aux;
  8. break;
  9. break;
  10. }
  11. }
  12. }
  13. //movement to the left
  14. for (i=0;i<h;i++){
  15. for (j=0;j<b;j++){
  16. if(mapa[i][j]==help){
  17. aux=mapa[i][j-1];
  18. mapa[i][j-1]=mapa[i][j];
  19. mapa[i][j]=aux;
  20. break;
  21. break;
  22. }
  23. }
  24. }
  25. //movement to the right
  26. for (i=0;i<h;i++){
  27. for (j=0;j<b;j++){
  28. if(mapa[i][j]==help){
  29. aux=mapa[i][j+1];
  30. mapa[i][j+1]=mapa[i][j];
  31. mapa[i][j]=aux;
  32. break;
  33. break;
  34. }
  35. }
  36. }
  37.  
  38. for (i=0;i<h;i++){
  39. for (j=0;j<b;j++){
  40. if(mapa[i][j]==help){
  41. aux=mapa[i+1][j];
  42. mapa[i+1][j]=mapa[i][j];
  43. mapa[i][j]=aux;
  44. break;
  45. break;
  46. }
  47. }
  48. }
Add Comment
Please, Sign In to add comment