?? othelloai.java
字號:
// 電腦下棋
class OthelloAI
{
private int color;
public OthelloAI(int c)
{
if (!(c == Cyberthello.WHITE || c == Cyberthello.BLACK))//不是黑子也不是白字
throw new IllegalArgumentException("Invalid value for color: " + c);//拋出錯誤,落子顏色不對
color = c;//把顏色置成電腦所執(zhí)的顏色
}
public Move chooseMove(OthelloBoard board)
{
for (int r = 0; r < 8; ++r)
for (int c = 0; c < 8; ++c)
{
Move move = new Move(r, c);
if (board.isValidMove(move, color))
return move;
}
return Move.pass;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -