black&real5d
This commit is contained in:
1 parent
2703618f3d
commit
ee38505e60
2 files changed
+37
-10
No files matched your search
+22
-3
@@ -188,10 +188,29 @@ def generate_ai_move(game: Game, ai_mode: str, ai_settings: Dict) -> Tuple[Move,
|
||||
if ai_mode != AI_RANK:
|
||||
n_moves = int(ai_settings["pick_frac"] * len(legal_policy_moves) + ai_settings["pick_n"])
|
||||
else:
|
||||
orig_calib_avemodrank = 0.063015 + 0.7624 * board_squares/(10**(-0.05737*ai_settings["kyu_rank"]+1.9482))
|
||||
orig_calib_avemodrank = 0.063015 + 0.7624 * board_squares / (
|
||||
10 ** (-0.05737 * ai_settings["kyu_rank"] + 1.9482)
|
||||
)
|
||||
norm_leg_moves = len(legal_policy_moves) / board_squares
|
||||
modified_calib_avemodrank = (0.3931+0.6559*norm_leg_moves*math.exp(-1*(3.002*norm_leg_moves*norm_leg_moves-norm_leg_moves-0.034889*ai_settings["kyu_rank"]-0.5097)**2)-0.01093*ai_settings["kyu_rank"]) * orig_calib_avemodrank
|
||||
n_moves = int(round(board_squares * norm_leg_moves/(1.31165*(modified_calib_avemodrank+1)-0.082653)))
|
||||
modified_calib_avemodrank = (
|
||||
0.3931
|
||||
+ 0.6559
|
||||
* norm_leg_moves
|
||||
* math.exp(
|
||||
-1
|
||||
* (
|
||||
3.002 * norm_leg_moves * norm_leg_moves
|
||||
- norm_leg_moves
|
||||
- 0.034889 * ai_settings["kyu_rank"]
|
||||
- 0.5097
|
||||
)
|
||||
** 2
|
||||
)
|
||||
- 0.01093 * ai_settings["kyu_rank"]
|
||||
) * orig_calib_avemodrank
|
||||
n_moves = int(
|
||||
round(board_squares * norm_leg_moves / (1.31165 * (modified_calib_avemodrank + 1) - 0.082653))
|
||||
)
|
||||
|
||||
if ai_mode in [AI_INFLUENCE, AI_TERRITORY, AI_LOCAL, AI_TENUKI]:
|
||||
if cn.depth > ai_settings["endgame"] * board_squares:
|
||||
|
||||
@@ -163,8 +163,10 @@ def averagemod(data):
|
||||
(int(lendata * 0.8) + 1) - int(lendata * 0.2)
|
||||
) # average without the best and worst 20% of ranks
|
||||
|
||||
|
||||
def gauss(data):
|
||||
return math.exp(-1*(data)**2)
|
||||
return math.exp(-1 * (data) ** 2)
|
||||
|
||||
|
||||
class RankGraph(Graph):
|
||||
black_rank_points = ListProperty([])
|
||||
@@ -195,15 +197,21 @@ class RankGraph(Graph):
|
||||
num_legal, rank, value = zip(*non_obvious_moves)
|
||||
rank = list(rank)
|
||||
for (i, item) in enumerate(rank):
|
||||
if item > num_legal[i]*0.09:
|
||||
rank[i] = num_legal[i]*0.09
|
||||
if item > num_legal[i] * 0.09:
|
||||
rank[i] = num_legal[i] * 0.09
|
||||
rank = tuple(rank)
|
||||
averagemod_rank = averagemod(rank)
|
||||
averagemod_len_legal = averagemod(num_legal)
|
||||
norm_avemod_len_legal = (averagemod_len_legal/num_intersec)
|
||||
rank_kyu = -0.97222*math.log(averagemod_rank)/(0.24634+averagemod_rank*gauss(3.3208*(norm_avemod_len_legal)))+12.703*(norm_avemod_len_legal)+11.198*math.log(averagemod_rank)+12.28*gauss(2.379*(norm_avemod_len_legal))-16.544
|
||||
if rank_kyu<-5:
|
||||
rank_kyu=-5
|
||||
norm_avemod_len_legal = averagemod_len_legal / num_intersec
|
||||
rank_kyu = (
|
||||
-0.97222 * math.log(averagemod_rank) / (0.24634 + averagemod_rank * gauss(3.3208 * (norm_avemod_len_legal)))
|
||||
+ 12.703 * (norm_avemod_len_legal)
|
||||
+ 11.198 * math.log(averagemod_rank)
|
||||
+ 12.28 * gauss(2.379 * (norm_avemod_len_legal))
|
||||
- 16.544
|
||||
)
|
||||
if rank_kyu < -4:
|
||||
rank_kyu = -4
|
||||
return 1 - rank_kyu # dan rank
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in new issue
Block a user