This commit is contained in:
2025-10-09 16:09:30 +08:00
parent b79f567b61
commit 5bb4fbe529

View File

@@ -0,0 +1,40 @@
package com.gitee.drinkjava2.frog.judge;
import com.gitee.drinkjava2.frog.Animal;
import com.gitee.drinkjava2.frog.Env;
/**
* judge method be called after animal's initAnimal method
*
* 这个类的judge方法在动物的初始化后被调用根据脑细胞群的三维结构形状来对动物进行奖罚即加减它的能量值这是一个临时类只是用来检验细胞三维成形功能以后可能改名或删除
*/
public class BrainColorJudge {
public static void judge(Animal animal) {//检查animal的脑细胞是否位于brainShape的范围内
for (int x = 0; x < Env.BRAIN_CUBE_SIZE; x++) {
for (int y = 0; y < Env.BRAIN_CUBE_SIZE; y++) {
for (int z = 0; z < Env.BRAIN_CUBE_SIZE; z++) {
if ((animal.cells[x][y][z] & 2) != 0)
if (x >= 1 && x <= 3) {
animal.award500();
} else {
animal.penalty1();
}
if ((animal.cells[x][y][z] & 4) != 0)
if (x >= 6 && x <= 8) {
animal.award50();
} else {
animal.penalty1();
}
if ((animal.cells[x][y][z] & 8) != 0)
if (x >= 11 && x <= 13) {
animal.award50();
} else {
animal.penalty1();
}
}
}
}
}
}