Skip to content

Commit b76067f

Browse files
committed
Gemini4
1 parent e05cef2 commit b76067f

File tree

1 file changed

+36
-23
lines changed

1 file changed

+36
-23
lines changed

src/nnue/features/half_ka_v2_hm.h

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -179,44 +179,57 @@ class HalfKAv2_hm {
179179
v[us_rook][opp_rook][us_knight_cannon][opp_knight_cannon] = [&] {
180180
if (us_rook == opp_rook)
181181
{
182-
// === 均势车力局面 (12个桶) ===
183-
// 我们用马炮数量差值的绝对值来衡量不平衡的程度
184-
int minor_imbalance =
185-
std::abs(static_cast<int>(us_knight_cannon)
186-
- static_cast<int>(opp_knight_cannon));
182+
// === 均势车力局面 (8个桶) ===
183+
int minor_adv = static_cast<int>(us_knight_cannon)
184+
- static_cast<int>(opp_knight_cannon);
187185

188-
uint8_t sub_bucket;
189-
if (minor_imbalance == 0)
186+
if (us_rook == 2) // 双方双车,最复杂,值得细分优势 (4个桶)
190187
{
191-
sub_bucket = 0; // 完全平衡
188+
if (minor_adv == 0)
189+
return 0; // 均势
190+
if (minor_adv == 1)
191+
return 1; // 我方稍优
192+
if (minor_adv == -1)
193+
return 2; // 对方稍优
194+
return 3; // 其他不平衡
192195
}
193-
else if (minor_imbalance == 1)
196+
else if (us_rook == 1) // 双方单车,只分平衡与否 (2个桶)
194197
{
195-
sub_bucket = 1; // 轻度不平衡
198+
return (minor_adv == 0) ? 4 : 5;
196199
}
197-
else if (minor_imbalance == 2)
200+
else // 双方无车,只分平衡与否 (2个桶)
198201
{
199-
sub_bucket = 2; // 中度不平衡
202+
return (minor_adv == 0) ? 6 : 7;
200203
}
201-
else
202-
{ // >= 3
203-
sub_bucket = 3; // 高度不平衡
204-
}
205-
206-
return us_rook * 4 + sub_bucket;
207204
}
208205
else
209206
{
210-
// === 非均势车力局面 (4个桶) ===
211-
// 完全保留基线的逻辑
207+
// === 非均势车力局面 (8个桶) ===
208+
// 与我第一次给出的方案一的这部分逻辑相同,但现在它是一个混合模型的一部分
212209
if (us_rook == 2 && opp_rook == 1)
213-
return 12;
210+
{
211+
return (us_knight_cannon >= opp_knight_cannon) ? 8 : 9;
212+
}
214213
else if (us_rook == 1 && opp_rook == 2)
214+
{
215+
return (us_knight_cannon <= opp_knight_cannon) ? 10 : 11;
216+
}
217+
else if (us_rook == 2 && opp_rook == 0)
218+
{
219+
return 12;
220+
}
221+
else if (us_rook == 0 && opp_rook == 2)
222+
{
215223
return 13;
216-
else if (us_rook > 0 && opp_rook == 0)
224+
}
225+
else if (us_rook == 1 && opp_rook == 0)
226+
{
217227
return 14;
218-
else // us_rook == 0 && opp_rook > 0
228+
}
229+
else // us_rook == 0 && opp_rook == 1
230+
{
219231
return 15;
232+
}
220233
}
221234
}();
222235
return v;

0 commit comments

Comments
 (0)