2019-11-03 13:00:45 +08:00
|
|
|
/*
|
|
|
|
Sanmill, a mill game playing engine derived from NineChess 1.5
|
|
|
|
Copyright (C) 2015-2018 liuweilhy (NineChess author)
|
2020-01-29 22:22:51 +08:00
|
|
|
Copyright (C) 2019-2020 Calcitem <calcitem@outlook.com>
|
2019-11-03 13:00:45 +08:00
|
|
|
|
|
|
|
Sanmill 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, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Sanmill 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 for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2019-07-28 02:40:49 +08:00
|
|
|
|
2019-06-30 07:40:27 +08:00
|
|
|
#ifndef CONFIG_H
|
|
|
|
#define CONFIG_H
|
|
|
|
|
2019-09-07 19:19:45 +08:00
|
|
|
#include "debug.h"
|
|
|
|
|
2019-08-11 14:26:36 +08:00
|
|
|
#if _MSC_VER >= 1600
|
|
|
|
#pragma execution_character_set("utf-8")
|
|
|
|
#endif
|
|
|
|
|
2019-08-26 22:33:27 +08:00
|
|
|
//#define MOBILE_APP_UI
|
|
|
|
|
2019-10-26 21:40:26 +08:00
|
|
|
//#define TRAINING_MODE
|
|
|
|
|
2019-12-13 22:42:07 +08:00
|
|
|
//#define TEST_MODE
|
|
|
|
|
2019-12-15 23:56:56 +08:00
|
|
|
//#define UCT_DEMO
|
|
|
|
|
2020-02-26 02:28:09 +08:00
|
|
|
#define ALPHABETA_AI
|
2020-05-04 19:24:54 +08:00
|
|
|
//#define PVS_AI
|
2020-05-04 18:57:07 +08:00
|
|
|
#define MTDF_AI
|
2020-02-26 02:02:39 +08:00
|
|
|
//#define MCTS_AI
|
|
|
|
|
2020-03-06 00:17:10 +08:00
|
|
|
//#define MCTS_PLD
|
|
|
|
|
2019-12-13 22:42:07 +08:00
|
|
|
#ifdef TEST_MODE
|
|
|
|
#define DONOT_PLAY_SOUND
|
|
|
|
#endif // TEST_MODE
|
|
|
|
|
2019-07-20 18:30:05 +08:00
|
|
|
//#define DEBUG_MODE
|
2019-08-04 13:12:29 +08:00
|
|
|
//#define DEBUG_MODE_A
|
2019-06-30 07:40:27 +08:00
|
|
|
|
2019-08-04 13:12:29 +08:00
|
|
|
#ifdef DEBUG_MODE_A
|
|
|
|
#define DONOT_PLAY_SOUND
|
|
|
|
#else
|
2019-07-21 03:26:03 +08:00
|
|
|
#define RANDOM_MOVE
|
2019-08-04 13:12:29 +08:00
|
|
|
#endif
|
2019-07-10 01:00:06 +08:00
|
|
|
|
2019-10-26 19:03:18 +08:00
|
|
|
#define DEFAULT_RULE_NUMBER 1
|
|
|
|
|
2019-11-03 17:43:27 +08:00
|
|
|
#define DEPTH_ADJUST (0)
|
2020-03-20 01:10:49 +08:00
|
|
|
//#define FIX_DEPTH (24)
|
2019-11-03 17:43:27 +08:00
|
|
|
|
2020-05-01 01:19:04 +08:00
|
|
|
//#define NULL_MOVE
|
|
|
|
|
2020-03-20 22:20:57 +08:00
|
|
|
//#define FIRST_MOVE_STAR_PREFERRED
|
|
|
|
|
2019-10-07 16:40:52 +08:00
|
|
|
//#define TIME_STAT
|
2019-11-10 12:36:31 +08:00
|
|
|
//#define CYCLE_STAT
|
2019-10-07 16:40:52 +08:00
|
|
|
|
2019-09-02 21:58:45 +08:00
|
|
|
//#define EVALUATE_ENABLE
|
2019-08-04 11:22:49 +08:00
|
|
|
|
|
|
|
#ifdef EVALUATE_ENABLE
|
2019-09-01 11:02:51 +08:00
|
|
|
//#define EVALUATE_MATERIAL
|
|
|
|
//#define EVALUATE_SPACE
|
2019-08-04 11:22:49 +08:00
|
|
|
#define EVALUATE_MOBILITY
|
2019-09-01 11:02:51 +08:00
|
|
|
//#define EVALUATE_TEMPO
|
|
|
|
//#define EVALUATE_THREAT
|
|
|
|
//#define EVALUATE_SHAPE
|
|
|
|
//#define EVALUATE_MOTIF
|
2019-08-04 11:22:49 +08:00
|
|
|
#endif /* EVALUATE_ENABLE */
|
|
|
|
|
2019-10-23 00:22:15 +08:00
|
|
|
#define SORT_MOVE_WITH_HUMAN_KNOWLEDGES
|
2019-08-04 03:17:53 +08:00
|
|
|
|
2019-10-20 03:14:20 +08:00
|
|
|
//#define IDS_WINDOW
|
2019-08-06 01:19:21 +08:00
|
|
|
|
2019-09-09 00:19:02 +08:00
|
|
|
#define TRANSPOSITION_TABLE_ENABLE
|
2019-07-04 00:12:05 +08:00
|
|
|
|
2019-09-09 00:19:02 +08:00
|
|
|
#ifdef TRANSPOSITION_TABLE_ENABLE
|
|
|
|
#define CLEAR_TRANSPOSITION_TABLE
|
2019-10-02 12:18:31 +08:00
|
|
|
#define TRANSPOSITION_TABLE_FAKE_CLEAN
|
2020-05-13 00:46:36 +08:00
|
|
|
//#define TRANSPOSITION_TABLE_FAKE_CLEAN_NOT_EXACT_ONLY
|
2020-04-19 10:43:25 +08:00
|
|
|
//#define TRANSPOSITION_TABLE_CUTDOWN
|
2020-05-03 13:16:30 +08:00
|
|
|
//#define TT_MOVE_ENABLE
|
2019-09-09 00:19:02 +08:00
|
|
|
//#define TRANSPOSITION_TABLE_DEBUG
|
2019-08-18 12:40:06 +08:00
|
|
|
#endif
|
2019-08-13 23:28:18 +08:00
|
|
|
|
2020-05-09 00:17:27 +08:00
|
|
|
//WIP
|
2020-05-03 19:59:39 +08:00
|
|
|
//#define HOSTORY_HEURISTIC
|
|
|
|
|
|
|
|
#ifdef HOSTORY_HEURISTIC
|
|
|
|
#define HOSTORY_HEURISTIC_ACTION_MOVE_ONLY
|
|
|
|
//#define HOSTORY_HEURISTIC_SCORE_HIGH_WHEN_DEEPER
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HOSTORY_HEURISTIC
|
|
|
|
//#define COMPARE_SCORE_ONLY
|
|
|
|
//#define COMPARE_RATING_PREFERRED
|
|
|
|
#define COMPARE_SCORE_PREFERRED
|
|
|
|
#else
|
|
|
|
#define COMPARE_RATING_ONLY
|
2020-05-04 02:31:28 +08:00
|
|
|
//#define COMPARE_RATING_1ST_VALUE_2ND
|
|
|
|
//#define COMPARE_VALUE_1ST_RATING_2ND
|
2020-05-03 19:59:39 +08:00
|
|
|
#endif // HOSTORY_HEURISTIC
|
|
|
|
|
2020-04-19 12:53:10 +08:00
|
|
|
#define PREFETCH_SUPPORT
|
2020-04-19 02:53:04 +08:00
|
|
|
|
2020-05-03 23:49:18 +08:00
|
|
|
// WIP, Debugging only
|
|
|
|
//#define OPENING_BOOK
|
|
|
|
|
2019-10-29 00:30:29 +08:00
|
|
|
//#define ENDGAME_LEARNING
|
2019-12-23 00:26:02 +08:00
|
|
|
//#define ENDGAME_LEARNING_FORCE
|
|
|
|
//#define ENDGAME_LEARNING_DEBUG
|
2019-07-04 00:12:05 +08:00
|
|
|
|
2019-07-27 02:44:24 +08:00
|
|
|
#define THREEFOLD_REPETITION
|
|
|
|
|
2019-07-29 22:58:40 +08:00
|
|
|
//#define MESSAGEBOX_ENABLE
|
|
|
|
|
2019-07-20 18:30:05 +08:00
|
|
|
#ifdef DEBUG_MODE
|
2019-06-30 11:59:06 +08:00
|
|
|
#define DONOT_PLAY_SOUND
|
2019-06-30 07:40:27 +08:00
|
|
|
#endif
|
|
|
|
|
2019-07-04 00:12:05 +08:00
|
|
|
//#define DONOT_PLAY_SOUND
|
2019-07-03 02:01:22 +08:00
|
|
|
|
2019-07-20 18:30:05 +08:00
|
|
|
#ifdef DEBUG_MODE
|
2019-09-08 15:15:21 +08:00
|
|
|
#define PLAYER_DRAW_SEAT_NUMBER
|
2019-06-30 07:40:27 +08:00
|
|
|
#endif
|
|
|
|
|
2019-08-27 13:52:08 +08:00
|
|
|
#ifndef MOBILE_APP_UI
|
2019-09-08 23:31:38 +08:00
|
|
|
#define SAVE_GAMEBOOK_WHEN_ACTION_NEW_TRIGGERED
|
2019-08-27 13:52:08 +08:00
|
|
|
#endif
|
2019-06-30 09:57:44 +08:00
|
|
|
|
2020-05-09 00:17:27 +08:00
|
|
|
//#define DONOT_PLAY_WIN_SOUND
|
2019-06-30 09:57:44 +08:00
|
|
|
|
2019-06-30 07:40:27 +08:00
|
|
|
// 摆棋阶段在叉下面显示被吃的子
|
2020-05-10 22:58:22 +08:00
|
|
|
//#define GAME_PLACING_SHOW_REMOVED_PIECES
|
2019-06-30 07:40:27 +08:00
|
|
|
|
|
|
|
// 启动时窗口最大化
|
|
|
|
//#define SHOW_MAXIMIZED_ON_LOAD
|
|
|
|
|
2019-07-14 22:35:45 +08:00
|
|
|
// 不使用哈希桶
|
|
|
|
#define DISABLE_HASHBUCKET
|
2019-09-14 23:51:41 +08:00
|
|
|
// 哈希表不加锁
|
|
|
|
#define HASHMAP_NOLOCK
|
2019-07-14 22:35:45 +08:00
|
|
|
|
2019-08-18 12:33:30 +08:00
|
|
|
#ifdef WIN32
|
|
|
|
#define sscanf sscanf_s
|
2019-08-25 19:22:53 +08:00
|
|
|
#define sprintf sprintf_s
|
2019-08-18 12:33:30 +08:00
|
|
|
#endif
|
|
|
|
|
2019-10-11 02:02:45 +08:00
|
|
|
#ifndef __GNUC__
|
|
|
|
#define __builtin_expect(expr, n) (expr)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define likely(expr) (__builtin_expect(!!(expr), 1))
|
|
|
|
#define unlikely(expr) (__builtin_expect(!!(expr), 0))
|
|
|
|
|
tt: 修复和未开启置换表的对战,执黑胜率少3%,执白胜率少6%的问题
同时对于 alpha-beta 的函数传参形式进行修改:
search(depth - 1 + epsilon, alpha, beta, node->children[i]); 改为
-search(depth - 1 + epsilon, -beta, -alpha, node->children[i]); 的形式。
简化必败以及明显劣势的判断方式。只要判断 root 的值,不需要看其孩子。
并顺带:
删除 MIN_MAX_ONLY 宏相关代码;
删除 SORT_CONSIDER_PRUNED、CLEAR_PRUNED_FLAG_BEFORE_SEARCH 宏相关代码;
新的 TT 算法和修改前算法对战 6000 盘。
黑 22% : 10%, 白 86% : 74% 有 12% 的优势。
速度提升 1.5%, 可以认为无变化。
和未开TT对战1700盘,均为 11% : 83%,误差不超过1%,故可认为新TT已经不会
造成明显劣化。开TT和未开TT比,目前是4.6倍速度比。
自对弈棋谱会变化。自对弈时长 12s+, 最后一步是 -(1,8), 白方胜。
2020-04-30 23:52:08 +08:00
|
|
|
#endif // CONFIG_H
|