Skip to content

Commit 79df963

Browse files
stubbiclaude
andauthored
feat: support initialStones for handicap games (#73)
Pass through the initialStones field from API requests to KataGo, enabling proper analysis of handicap games where black stones are pre-placed on the board. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2379b3a commit 79df963

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

charts/katago-server/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ type: application
66
# This is the chart version. This version number should be incremented each time you make changes
77
# to the chart and its templates, including the app version.
88

9-
version: 1.7.2
9+
version: 1.7.3
1010

1111
# This is the version number of the application being deployed.
1212
# KataGo v1.16.4 for CUDA 12 support and human-style model support
13-
appVersion: "1.7.2"
13+
appVersion: "1.7.3"
1414

1515

1616
keywords:

src/analysis_engine.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,22 @@ impl AnalysisEngine {
555555
color = if color == "b" { "w" } else { "b" };
556556
}
557557

558+
// Convert initial_stones from API format (tuples) to KataGo format (vecs)
559+
// API: [("B", "D16"), ("B", "Q4")] -> KataGo: [["B", "D16"], ["B", "Q4"]]
560+
let initial_stones: Vec<Vec<String>> = request
561+
.initial_stones
562+
.as_ref()
563+
.map(|stones| {
564+
stones
565+
.iter()
566+
.map(|(color, coord)| vec![color.clone(), coord.clone()])
567+
.collect()
568+
})
569+
.unwrap_or_default();
570+
558571
let query = AnalysisQuery {
559572
id: request_id.clone(),
560-
initial_stones: vec![], // Empty for standard games (could support handicap via API later)
573+
initial_stones,
561574
moves: katago_moves,
562575
rules: request.rules.clone().unwrap_or_else(|| {
563576
// Auto-detect rules from komi

0 commit comments

Comments
 (0)