Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. int aleatorio=(int)Math.floor(Math.random()*4);
  2. int aleatorio2=(int)Math.floor(Math.random()*7+2);
  3. int aleatorio0=(int)Math.floor(Math.random()*5);
  4. int aleatorio3=aleatorio2+aleatorio0;
  5.  
  6. for(int z=0;z<map.length;z++){
  7. for(int x=0;x<map[z].length;x++){
  8. switch(aleatorio){
  9. case 0:
  10. map[0][x]=new Square(2);
  11.  
  12. if(x>aleatorio2){
  13. map[1][x]=new Square(2);
  14. }
  15. if(x>aleatorio3){
  16. map[2][x]=new Square(2);
  17. }
  18. break;
  19. case 1:
  20. map[9][x]=new Square(2);
  21. if(x>aleatorio2){
  22. map[8][x]=new Square(2);
  23. }
  24. if(x>aleatorio3){
  25. map[7][x]=new Square(2);
  26. }
  27.  
  28. break;
  29. case 2:
  30. map[z][0]=new Square(2);
  31. if(z>aleatorio2){
  32. map[z][1]=new Square(2);
  33. }
  34. if(z>aleatorio3){
  35. map[z][2]=new Square(2);
  36. }
  37.  
  38. break;
  39. case 3:
  40. map[z][9]=new Square(2);
  41. if(z>aleatorio2){
  42. map[z][8]=new Square(2);
  43. }
  44. if(z>aleatorio3){
  45. map[z][7]=new Square(2);
  46. }
  47. break;
  48. default:;
  49. }
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement