• 大小: 603KB
    文件类型: .gz
    金币: 1
    下载: 0 次
    发布日期: 2021-06-09
  • 语言: Html/CSS
  • 标签: gnugo  围棋  

资源简介

GNU Go是免费的带源代码的人机对弈软件,棋力在九级左右。和其它GNU 软件一样, 它遵从 GNU 公用许可证GPL。你可免费获得它的源代码,并可自由使用和修改。 但GNU GO只提供字符界面,更多相关内容请参见其主页: http://www.gnu.org/software/gnugo/gnugo.html

资源截图

代码片段和文件信息

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
 * This is GNU GO a Go program. Contact gnugo@gnu.org or see   *
 * http://www.gnu.org/software/gnugo/ for more information.      *
 *                                                               *
 * Copyright 1999 and 2000 by the Free Software Foundation.      *
 *                                                               *
 * This program is free software; you can redistribute it and/or *
 * modify it under the terms of the GNU General Public License   *
 * as published by the Free Software Foundation - version 2.     *
 *                                                               *
 * This program is distributed in the hope that it will be       *
 * useful but WITHOUT ANY WARRANTY; without even the implied    *
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR       *
 * PURPOSE.  See the GNU General Public License in file COPYING  *
 * for more details.                                             *
 *                                                               *
 * You should have received a copy of the GNU General Public     *
 * License along with this program; if not write to the Free    *
 * Software Foundation Inc. 59 Temple Place - Suite 330       *
 * Boston MA 02111 USA                                         *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */


/* ---------------------------------------------------
 *   attdef.c -- Find attacking and defending moves.
 * ----------------------------------------------------
 */

/*
 * This file contains move generators directly called by genmove().
 */


#include 
#include 
#include 
#include “liberty.h“


static int active_defense(int m int n int color);


/* defender() looks for strings of my color which you can kill and
 * recommends defending them.
 */

int 
defender (int *i int *j int *val int *equal_moves int color
  int shapei int shapej)
{
  int m n tval;
  int found_one=0;
  int ti tj;
  
  TRACE(“Defender is THINKING for %s!\n“ color==WHITE ? “white“ : “black“);
  
  for (m=0;m    for (n=0;n
      if (p[m][n] != color                 /* our piece */
  || worm[m][n].origini != m       /* origin of ... */
  || worm[m][n].originj != n       /* ... a worm */
  || worm[m][n].attacki == -1      /* en prise   */
  || worm[m][n].defendi == -1      /* defensible */
  || worm[m][n].ko                /* ko left to ko_important_helper */
  || worm[m][n].inessential
  || !legal(worm[m][n].defendi worm[m][n].defendj color)) /* legal */
continue;

      /* Considered move */
      ti = worm[m][n].defendi;
      tj = worm[m][n].defendj;
  
      /* bonus if the string has fewer liberties since capturing
       * leaves less aji
       */
      tval = worm[m][n].value + 3 - 2*worm[m][n].liberties;

      /* penalty if the string is nearly surrounded. */
      if (dragon[m][n].escape_route 

评论

共有 条评论

相关资源