| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1334 人关注过本帖
标题:'class'or'interface'expected是什么
只看楼主 加入收藏
qiucongguang
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-11-27
收藏
 问题点数:0 回复次数:1 
'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 
2008-11-27 10:40
baifenghan
Rank: 8Rank: 8
等 级:贵宾
威 望:10
帖 子:258
专家分:952
注 册:2006-3-17
收藏
得分:0 
信息过少
无法诊断啊
2008-11-27 18:04
快速回复:'class'or'interface'expected是什么
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025794 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved