Skip to content

Commit bf73ff0

Browse files
domino14claude
andcommitted
make analyze-turn work on current turn instead of requiring parameter
Changed analyze-turn to analyze the current turn (from sc.game.Turn()) instead of requiring a -turn parameter. This is much more intuitive: - Navigate to a turn with 'n' and 'p' - Run 'analyze-turn' to analyze that position Updated help text to reflect this simpler usage. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 2089694 commit bf73ff0

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

shell/analyze.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func formatPlayerSummaries(summaries [2]*gameanalysis.PlayerSummary) string {
233233
return sb.String()
234234
}
235235

236-
// analyzeTurn analyzes a single turn in the loaded game
236+
// analyzeTurn analyzes the current turn in the loaded game
237237
func (sc *ShellController) analyzeTurn(cmd *shellcmd) (*Response, error) {
238238
if sc.game == nil {
239239
return nil, errors.New("no game loaded; please load a game first with 'load'")
@@ -244,14 +244,10 @@ func (sc *ShellController) analyzeTurn(cmd *shellcmd) (*Response, error) {
244244
return nil, errors.New("no game history to analyze")
245245
}
246246

247-
// Get turn number (required)
248-
turnNumOpt, err := cmd.options.Int("turn")
249-
if err != nil || turnNumOpt < 0 {
250-
return nil, errors.New("please specify -turn <number> (0-indexed event number)")
251-
}
252-
247+
// Get current turn number
248+
turnNumOpt := sc.game.Turn()
253249
if turnNumOpt >= len(history.Events) {
254-
return nil, fmt.Errorf("turn %d out of range (game has %d events)", turnNumOpt, len(history.Events))
250+
return nil, fmt.Errorf("current turn %d is out of range (game has %d events)", turnNumOpt, len(history.Events))
255251
}
256252

257253
// Create analyzer

shell/helptext/analyze-turn.txt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
analyze-turn -turn <n>
1+
analyze-turn
22

3-
Analyzes a single turn in the loaded game.
3+
Analyzes the current turn in the loaded game.
44

5-
Options:
6-
-turn <n> Turn number to analyze (0-indexed event number)
7-
8-
This command analyzes just one specific turn instead of the entire game,
5+
This command analyzes just the current turn instead of the entire game,
96
which is much faster for debugging or examining specific positions.
107

11-
The turn number is the 0-indexed event number from the game history.
12-
Use 'list' to see all events and their numbers.
8+
Use 'n' and 'p' to navigate to different turns, then run analyze-turn
9+
to see the analysis for that position.
1310

1411
The analysis shows:
1512
- Player's rack and the move they played

shell/helptext/usage-standard.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Examining a game:
3434
explain [options] - generate AI explanation for current position
3535
challenge [n] - add a challenge bonus to the last play of n points, or challenge play off.
3636
analyze [options] - analyze all moves in the loaded game
37-
analyze-turn -turn <n> - analyze a single turn in the game
37+
analyze-turn - analyze the current turn
3838
analyze-batch <filepath> - analyze multiple games from a directory
3939
Other:
4040
export <filepath> - export a game to .gcg

0 commit comments

Comments
 (0)