Guest User

Untitled

a guest
Jan 6th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1.  
  2. public Direction attaquer(GameMap map, Location location, int myID) {
  3. Location[] locations = analyse4autourLocation(map, location);
  4. Direction out = null;
  5. int maxAdv = 0;
  6. for (int i = 0; i < locations.length; i++) {
  7. Location l = locations[i];
  8.  
  9. Site[] analyseAut = analyse4Autour(map, location);
  10. int nbrAdv = 0;
  11. for (Site s : analyseAut) {
  12. if(s.owner!=myID&&s.owner!=0){
  13. nbrAdv++;
  14. }
  15. }
  16. if (nbrAdv > maxAdv) {
  17. maxAdv = nbrAdv;
  18. out = Direction.CARDINALS[0];
  19. }
  20. }
  21. return out;
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment