続けて質問なのですが、現在はAiは一番多くマスが取れる位置に置く設定になっています。もう少し対局を楽しみたいので、最善手であろう場所に打つコードが分かる方教えてほしいです。
現在のAiのコードをのせときます
全体のコードは一つ前の質問にのせています
class Ai {
Board board;
int stone;
Ai(Board board, int stone) {
this.board = board;
this.stone = stone;
}
Cell think() {
int max = 0;
Cell cellToPut = null;
ArrayList<Cell> candidates = board.getAvailableCells();
for(Cell cell: candidates) {
ArrayList<Cell> cellsToFlip = board.cellsToFlipWith(cell, Cell.WHITE);
if(max < cellsToFlip.size()){
max = cellsToFlip.size();
cellToPut = cell;
}
}
return cellToPut;
}
}