samplevaluer.java

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

JAVA
42
字号
/* * SampleValuer.java * * Created on 2007-9-29, 11:49:04 * * 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 SampleValuer implements IValuer //简单的判断棋子是否属于我方,应用与终局搜索可获得准确估值;{    public long getValue(Step[][] steps,boolean side)    {        long value = 0;        for (int i = 0; i < steps.length; i++)        {            for (int j = 0; j < steps[0].length; j++)            {                if (steps[i][j] != null)                {                    if (steps[i][j].getColor().booleanValue() == side)                    {                        value++;                    } else                    {                        value--;                    }                }            }        }        return value;    }}

⌨️ 快捷键说明

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