当前位置: 代码迷 >> Java相关 >> 'class'or'interface'expected是什么
  详细解决方案

'class'or'interface'expected是什么

热度:822   发布时间:2008-11-27 10:40:20.0
'class'or'interface'expected是什么
package nicholas.game.chess;

class FirstAI extends ChessPlayer {

private ChessModel model[][][];
private StepStack stack;
private Step step;
private int layer;
private int turn;
protected GameRule gameRule;

public FirstAI(int t) {
super(false);
stack = new StepStack();
layer = 7;
// layer = 3;
turn = t;
}

public String getName() {
return "ColinRobot";
}

public Step getNextStep(ChessModel m[][][]) {
//algo
model = m;
System.out.println("max="+getLayerValue(0));
stack.removeAll();
return step;
}

private int getLayerValue(int lay) {
if(lay>layer) {
return -1*getModelValue();
}
int value = 0;
int max = -2000;
int decision;
for(int z=0;z<3;z++) {
for(int y=0;y<3;y++) {
for(int x=0;x<3;x++) {
if((x==1&&y==1)||model[z][y][x].isOccupied()) continue;
model[z][y][x].acceptChessman(Chessman.CHESS[(turn+lay)%2]);
decision = gameRule.checkStep(model[z][y][x], model);
switch(decision) {
case 0://win
stack.add(new Step(model[z][y][x],decision));
value = 1000;
break;
case 3://tiaodan|gan
gameRule.checkDecision(model[z][y][x],1,model);
stack.add(new Step(model[z][y][x],1));
value = 660;

break;
case 1://tiaodan
stack.add(new Step(model[z][y][x],decision));
value = 660;
break;
case 2://gan
stack.add(new Step(model[z][y][x],decision));
value = 320;
break;
default://tiaodan,gan,none
stack.add(new Step(model[z][y][x],decision));
value = -1*getLayerValue(lay+1);
}
if(value>max) {
max = value;
if(lay==0) {
//first layer, save step
System.out.println("max="+max);
step = stack.getTop();
}
}
//remove chessman
gameRule.undoStep(stack.remove(),model);
if(max==1000) return max;
}
}
}
return max;
}

private int getModelValue() {
return 3;
}

public void setGameRule(GameRule rule) {
gameRule = rule;
}
}
'class'or'interface'expexted at line 20 (20:1)
1 error
搜索更多相关的解决方案: interface  expected  class  

----------------解决方案--------------------------------------------------------
信息过少
无法诊断啊
----------------解决方案--------------------------------------------------------
  相关解决方案