Guest User

Untitled

a guest
Jul 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. public boolean podriaMoverse( String dir )
  2. {
  3. boolean resp = true;
  4.  
  5. if( dir == NOROESTE )
  6. {
  7. if( colLadron-- < 0 || filaLadron-- < 0 )
  8. {
  9. resp = false;
  10. }
  11. }
  12. else if( dir == NORTE )
  13. {
  14. if( filaLadron-- < 0 )
  15. {
  16. resp = false;
  17. }
  18. }
  19. else if( dir == NORESTE )
  20. {
  21. if( colLadron++ > 12 || filaLadron-- < 0 )
  22. {
  23. resp = false;
  24. }
  25. }
  26. else if( dir == ESTE )
  27. {
  28. if( colLadron < 0 )
  29. {
  30. resp = false;
  31. }
  32. }
  33. else if( dir == OESTE )
  34. {
  35. if( colLadron++ > 12 )
  36. {
  37. resp = false;
  38. }
  39. }
  40. else if( dir == SUROESTE )
  41. {
  42. if( colLadron-- < 0 || filaLadron++ > 12 )
  43. {
  44. resp = false;
  45. }
  46. }
  47. else if( dir == SUR )
  48. {
  49. if( filaLadron++ > 12 )
  50. {
  51. resp = false;
  52. }
  53. }
  54. else if( dir == SURESTE )
  55. {
  56. if( colLadron++ > 12 || filaLadron++ > 12 )
  57. {
  58. resp = false;
  59. }
  60. }
  61.  
  62. return resp;
  63. }
Add Comment
Please, Sign In to add comment