已解決
想弄一个像http://www.u148.net/game/month_0901/flipit/的游戏开始全白棋,只要把白棋全转黑就胜利
面板已弄好,但翻转棋子时出问题
部份code:
if(iswhite==true){
System.out.print("White");
iswhite=false;
}
else{
System.out.print("Black");
iswhite=false;}
结果为:WhiteBlack, 就是说棋子会先转黑马上再转回白
但这段不是只出White或Black,为什么全执行了?
Debug:
Thread (Running)
Daemon Thread (Running)
Thread (Running)
Thread (Running)
Daemon Thread (Running)
Daemon Thread (Running)
Daemon Thread (Running) 建议用println,顺便把row, col都打出来 我设定了(因课题要求要面板可设定大小,size1是用户输入的,列和行的棋子数)
button=new Disc;
iswhite = new boolean;
iswhite是用作检查棋子是黑还是白, true=白, false=黑
row col 的值是之前一个class Disc中用来找button(在用来产生棋子的for循环中)的坐标
我在产生棋子的for循环中加入了iswhite = true; 希望把棋子设为白色 先确定一个问题,楼主你确定你要做的翻转棋是像你给的连接的那样的?和我认识中的翻转棋完全不是一回事啊 怎麼有很重的既視感........
assignment....? 嵌循环里了吧? 然后又判断了一次? LZ好歹放多点代码嘛
页:
[1]