我正在玩的程序有一些问题。我正在尝试做这个弹珠游戏,玩家在电脑上玩并移除弹珠,直到棋盘为空。我的问题是我用来移除弹珠的课程似乎没有移除它。我认为这很简单,但我只是不明白。我认为我遇到问题的部分是大写字母:
Pile tiles = new Pile();
tiles.createMarbles();
marbles = tiles.getMarbles();
System.out.println("There are now " + marbles + " left!");
HumanPlayer hum = new HumanPlayer();
SmartMode cpu = new SmartMode();
StupidMode badcpu = new StupidMode();
//ComputerMove cpu = new ComputerMove();
//PlayerMove hum = new PlayerMove();
do {
if (compMove == true && marbles > 1) {
if (compSmart) {
//marbles = cpu.move(marbles);
tiles.removesMarbles(cpu.move(marbles)); //THIS RIGHT HERE
System.out.println("There are now " + marbles + " left!");
compMove = false;
} if (!compSmart) {
//marbles = badcpu.move(marbles);
tiles.removesMarbles(badcpu.move(marbles)); // THIS RIGHT HERE
System.out.println("There are now " + marbles + " left!");
compMove = false;
}
/* marbles = (cpu.ComputerMove(marbles, compSmart));
System.out.println("There are now " + marbles + " left!");
compMove = false;*/
} else if (compMove == false && marbles > 1) {
//marbles = (hum.move(marbles));
tiles.removesMarbles(hum.move(marbles)); // THIS RIGHT HERE
System.out.println("There are now " + marbles + " left!");
compMove = true;
}
} while (marbles > 1);
其余的不需要回答