Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. int srodek = 50;
  2.  
  3. map[srodek][srodek] = 1;
  4.  
  5. int dystans = 4; // dystans pomiędzy warstwami
  6. int warstwa = 1; // numer warstwy
  7. int bok = 1; // który z 4 boków kwadratu XD
  8.  
  9.  
  10. int startX = 0;
  11. int startY = 0;
  12. int endX = 0;
  13. int endY = 0;
  14.  
  15. if (bok == 1) {
  16. startX = srodek - warstwa*dystans;
  17. startY = srodek - warstwa*dystans;
  18. endX = srodek + warstwa*dystans;
  19. endY = srodek - warstwa*dystans;
  20. }
  21. // itd.
  22.  
  23. Random r = new Random();
  24. int coordinateX = r.nextInt(endX - startX) + startX;
  25. int coordinateY = r.nextInt(endY - startY) + startY;
  26.  
  27. // while(userRepository.findByCoordinateXAndCoordinateY(coordinateX,coordinateY)!=null && fieldRepository.findByCoordinateXAndCoordinateY(coordinateX,coordinateY)!=null){
  28. // coordinateX = random.nextInt(100);
  29. // coordinateY = random.nextInt(100);
  30. // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement