上QQ阅读APP看本书,新人免费读10天
设备和账号都新为新人
5.4 位置分值
给每个棋子一个固定的值,然后将所有还在棋盘上棋子的价值求和即得到。这种方法简单易实现,各种棋子的分值也基本体现了各种棋子的重要性。然而这种估值方法太过简单,一个棋子在棋局的真正价值,不仅与固定分值有关,还与所处位置,棋子间协作与牵制相关联。
同样是车,开局时车处在最边角的位置,只有一个走法。它此时既不能攻击对方,又不能对本方棋子形成更多的保护,使车的作用没有更大的发挥出来。开局时,一般要尽快将车出动到重要的线路上,让它发挥更大的价值。车的价值与它的位置密切相关。
卒是另一个重要的例子。在未过河前,卒只能向前走,基本没有攻击力,对将的保护也无力。过河后,可以横向移动,威胁更大,尤其当卒行进到对方九宫附件时,其价值大大增强。
定义一个三维数组来表示不同棋子在不同位置的分值,
static const unsigned char PositionValues[2][7][256]
第一维表示走方,0为红方,1为黑方,第二维表示棋子种类,0到6分别表示将、士、象、马、车、炮、卒,第三维表示位置。为了能快速求得每种棋子对应的下标值,特别增加一个辅助数组。
const char PieceNumToType[48] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 6, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 6 };
位置分值数组如下。
static const unsigned char PositionValues[2][7][256] = { { { // 红帅 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 80, 90, 80, 70, 80, 90, 80, 70, 0, 0, 0, 0, 0, 0, 0, 80,110,125, 90, 70, 90,125,110, 80, 0, 0, 0, 0, 0, 0, 0, 90,100,120,125,120,125,120,100, 90, 0, 0, 0, 0, 0, 0, 0, 90,100,120,130,110,130,120,100, 90, 0, 0, 0, 0, 0, 0, 0, 90,110,110,120,100,120,110,110, 90, 0, 0, 0, 0, 0, 0, 0, 90,100,100,110,100,110,100,100, 90, 0, 0, 0, 0, 0, 0, 0, 80, 90,100,100, 90,100,100, 90, 80, 0, 0, 0, 0, 0, 0, 0, 80, 80, 90, 90, 80, 90, 90, 80, 80, 0, 0, 0, 0, 0, 0, 0, 70, 75, 75, 70, 50, 70, 75, 75, 70, 0, 0, 0, 0, 0, 0, 0, 60, 70, 75, 70, 60, 70, 75, 70, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { // 红车 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,160,170,160,150,150,150,160,170,160, 0, 0, 0, 0, 0, 0, 0,170,180,170,190,250,190,170,180,170, 0, 0, 0, 0, 0, 0, 0,170,190,200,220,240,220,200,190,170, 0, 0, 0, 0, 0, 0, 0,180,220,210,240,250,240,210,220,180, 0, 0, 0, 0, 0, 0, 0,180,220,210,240,250,240,210,220,180, 0, 0, 0, 0, 0, 0, 0,180,220,210,240,250,240,210,220,180, 0, 0, 0, 0, 0, 0, 0,170,190,180,220,240,220,200,190,170, 0, 0, 0, 0, 0, 0, 0,170,180,170,170,160,170,170,180,170, 0, 0, 0, 0, 0, 0, 0,160,170,160,160,150,160,160,170,160, 0, 0, 0, 0, 0, 0, 0,150,160,150,160,150,160,150,160,150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { // 红炮 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,125,130,100,70,60,70,100,130,125, 0, 0, 0, 0, 0, 0, 0,110,125,100,70,60,70,100,125,110, 0, 0, 0, 0, 0, 0, 0,100,120, 90, 80, 80, 80, 90,120,100, 0, 0, 0, 0, 0, 0, 0, 90,110, 90,110,130,110, 90,110, 90, 0, 0, 0, 0, 0, 0, 0, 90,110, 90,110,130,110, 90,110, 90, 0, 0, 0, 0,
0, 0, 0, 90,100, 90,110,130,110, 90,100, 90, 0, 0, 0, 0, 0, 0, 0, 90,100, 90, 90,110, 90, 90,100, 90, 0, 0, 0, 0, 0, 0, 0, 90,100, 80, 80, 70, 80, 80,100, 90, 0, 0, 0, 0, 0, 0, 0, 80, 90, 80, 70, 65, 70, 80, 90, 80, 0, 0, 0, 0, 0, 0, 0, 80, 90, 80, 70, 60, 70, 80, 90, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, {//黑马 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 70, 75, 70, 60, 70, 75, 70, 60, 0, 0, 0, 0, 0, 0, 0, 70, 75, 75, 70, 50, 70, 75, 75, 70, 0, 0, 0, 0, 0, 0, 0, 80, 80, 90, 90, 80, 90, 90, 80, 80, 0, 0, 0, 0, 0, 0, 0, 80, 90,100,100, 90,100,100, 90, 80, 0, 0, 0, 0, 0, 0, 0, 90,100,100,110,100,110,100,100, 90, 0, 0, 0, 0, 0, 0, 0, 90,110,110,120,100,120,110,110, 90, 0, 0, 0, 0, 0, 0, 0, 90,100,120,130,110,130,120,100, 90, 0, 0, 0, 0, 0, 0, 0, 90,100,120,125,120,125,120,100, 90, 0, 0, 0, 0, 0, 0, 0, 80,110,125, 90, 70, 90,125,110, 80, 0, 0, 0, 0, 0, 0, 0, 70, 80, 90, 80, 70, 80, 90, 80, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, {//黑车 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,150,160,150,160,150,160,150,160,150, 0, 0, 0, 0, 0, 0, 0,160,170,160,160,150,160,160,170,160, 0, 0, 0, 0, 0, 0, 0,170,180,170,170,160,170,170,180,170, 0, 0, 0, 0, 0, 0, 0,170,190,200,220,240,220,180,190,170, 0, 0, 0, 0, 0, 0, 0,180,220,210,240,250,240,210,220,180, 0, 0, 0, 0, 0, 0, 0,180,220,210,240,250,240,210,220,180, 0, 0, 0, 0, 0, 0, 0,180,220,210,240,250,240,210,220,180, 0, 0, 0, 0, 0, 0, 0,170,190,200,220,240,220,200,190,170, 0, 0, 0, 0, 0, 0, 0,170,180,170,190,250,190,170,180,170, 0, 0, 0, 0, 0, 0, 0,160,170,160,150,150,150,160,170,160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, {//黑炮 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 90, 80, 70, 60, 70, 80, 90, 80, 0, 0, 0, 0, 0, 0, 0, 80, 90, 80, 70, 65, 70, 80, 90, 80, 0, 0, 0, 0, 0, 0, 0, 90,100, 80, 80, 70, 80, 80,100, 90, 0, 0, 0, 0, 0, 0, 0, 90,100, 90, 90,110, 90, 90,100, 90, 0, 0, 0, 0, 0, 0, 0, 90,100, 90,110,130,110, 90,100, 90, 0, 0, 0, 0, 0, 0, 0, 90,110, 90,110,130,110, 90,110, 90, 0, 0, 0, 0, 0, 0, 0, 90,110, 90,110,130,110, 90,110, 90, 0, 0, 0, 0, 0, 0, 0,100,120, 90, 80, 80, 80, 90,120,100, 0, 0, 0, 0, 0, 0, 0,110,125,100,70,60,70,100,125,110, 0, 0, 0, 0, 0, 0, 0,125,130,100,70,60,70,100,130,125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, {//黑卒 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 10, 0, 15, 0, 10, 0, 10, 0, 0, 0, 0, 0, 0, 0, 10, 0, 15, 0, 15, 0, 15, 0, 10, 0, 0, 0, 0, 0, 0, 0, 15, 20, 20, 20, 20, 20, 20, 20, 15, 0, 0, 0, 0, 0, 0, 0, 20, 25, 25, 30, 30, 30, 25, 25, 20, 0, 0, 0, 0, 0, 0, 0, 25, 30, 30, 40, 40, 40, 30, 30, 25, 0, 0, 0, 0, 0, 0, 0, 25, 30, 40, 50, 60, 50, 40, 30, 25, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 20, 25, 20, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } };
代码技巧
要计算红方车在位置p的值,直接读取数组PositionValue[0][ PieceNumToType[23]][p]就得到了(假设此车编码为23)。
位置分值根据棋手多年的经验而得,有些难以量化,只能是尽量模拟。作者在此只是根据自己的经验做了一个初略的估值,读者可以根据自己的棋力来赋值。