latentactivityvaluer.java

来自「一个黑白棋的源代码(尚未完成」· Java 代码 · 共 45 行

JAVA
45
字号
/* * ActivityValuer.java * * Created on 2007-10-8, 17:41:41 * * To change this template, choose Tools | Templates * and open the template in the editor. */package org.yangcq.logic.valuer;import org.yangcq.logic.step.Step;/** * * @author Administrator */public class LatentActivityValuer implements IValuer{    public long getValue(Step[][] board, boolean side)//潜在行动力估值,简单速度快,适合    {        long value = 0l;        for (int i = 0; i < board.length; i++)        {            for (int j = 0; j < board.length; j++)            {                if (board[i][j] == null)                {                    for (int x = i - 1; x < x + 2; x++)                    {                        for (int y = j - 1; y < j + 2; y++)                        {                            if (x >= 0 && y >= 0 && x < board.length && y < board.length && board[x][y] != null && board[x][y].getColor().booleanValue() == !side)                            {                                value++;                            }                        }                    }                }            }        }        return value;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?