Jump to content

codingstyle

Members
  • Posts

    10
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

codingstyle's Achievements

Newbie

Newbie (1/10)

1

Reputation

  1. http://docs.oracle.com/javase/tutorial/java/ even if you know most of the stuff there read it all again, because you may have some bad habits, which you didn't know of Also you will leran java naming conventions
  2. I know that this will sound a bit fussy, but you really have to work on your java naming conventions. This will improve the readability and quality of your code so much in the long term! things i recognised: Objects = lowercase (Script s) use the final keyword (final Script s, final boolean direction, ....) Things i don't understand: if(direction) { for(int u = 0; u < fullPath.size(); u++) { Position p = fullPath.get(u); if(S.distance(p) < 11) { int xOffSet = MethodProvider.random(3)-1; int yOffSet = MethodProvider.random(3)-1; return new Position(p.getX()+ xOffSet,p.getY()+yOffSet,S.myZ()); } } } else { for(int u = fullPath.size()-1; u > 0; u=u-1) { Position p = fullPath.get(u); if(S.distance(p) < 10) { int xOffSet = MethodProvider.random(5)-2; int yOffSet = MethodProvider.random(5)-2; return new Position(p.getX()+ xOffSet,p.getY()+yOffSet,S.myZ()); } } } why do you have different offset based on the direction your walking? why do you have different conditions? (S.distance(p) < 10 ...... S.distance(p) < 11) please rework the things i told you and post again Edit: make Script private and rethink private/public on your methods...
  3. using u++ but u = u-1 seriously? (u--) Useful class btw.
×
×
  • Create New...