Skip to content

Instantly share code, notes, and snippets.

@Matsemann
Created October 22, 2013 08:25
Show Gist options
  • Save Matsemann/7097044 to your computer and use it in GitHub Desktop.
Save Matsemann/7097044 to your computer and use it in GitHub Desktop.
Egg carton diagonal
// \-diagonals
for (int i = (- EggCartonRunner.M) + 2; i < EggCartonRunner.M - 1; i++) {
eggsInLoop = 0;
for (int j = 0; j < EggCartonRunner.M; j++) {
if (i+j >= 0 && i+j < EggCartonRunner.M) {
if (state[j][i+j]) {
eggsInLoop++;
}
}
}
if (eggsInLoop > EggCartonRunner.K) {
score = score - (eggsInLoop - EggCartonRunner.K);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment