Skip to content

Instantly share code, notes, and snippets.

@chopmann
Created October 28, 2013 21:19
Show Gist options
  • Save chopmann/7204928 to your computer and use it in GitHub Desktop.
Save chopmann/7204928 to your computer and use it in GitHub Desktop.
// Dein Code
public int getAnzahlTiere(int x, int y) {
int count = 0;
for (int k = 0; k < ; k++)
if (this.map[x][y].tiere.get(k) != null) {
count++;
}
return count;
}
// Wie ich es meine
public int getAnzahlTiere(int x, int y) {
return count this.map[x][y].tiere.size();
}
// bei "x" und "y" muss du aufpassen das es nicht "über den rand geht".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment