Skip to content

Commit a90ab48

Browse files
Merge pull request #249 from CSSLab/codex/staged-strategy-main
Add staged Stockfish strategy and debug diagnostics panel
2 parents 920ff4a + 4fc7b2f commit a90ab48

9 files changed

Lines changed: 2461 additions & 71 deletions

File tree

src/components/Analysis/Highlight.tsx

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ export const Highlight: React.FC<Props> = ({
357357
const useCompactMobileColumnTitles = isMobile && !simplified
358358
const mobileMaiaColumnTitle = `Maia ${currentMaiaModel.slice(-4)}: Human Moves`
359359
const mobileStockfishColumnTitle = 'SF 17: Engine Moves'
360+
const stockfishDepth = moveEvaluation?.stockfish?.depth
361+
const stockfishDepthLabel = stockfishDepth ? `d${stockfishDepth}` : null
360362
const openMaiaHeaderPicker = () => {
361363
const select = maiaHeaderSelectRef.current as
362364
| (HTMLSelectElement & { showPicker?: () => void })
@@ -496,10 +498,13 @@ export const Highlight: React.FC<Props> = ({
496498
return (
497499
<button
498500
key={index}
499-
className="flex w-full cursor-pointer items-center justify-between hover:underline"
500-
style={{
501-
color: colorSanMapping[move]?.color ?? '#fff',
502-
}}
501+
className="flex w-full cursor-pointer items-center justify-between text-human-1 hover:underline"
502+
style={
503+
colorSanMapping[move]?.color &&
504+
colorSanMapping[move].color !== '#FFF'
505+
? { color: colorSanMapping[move].color }
506+
: undefined
507+
}
503508
onMouseLeave={handleMouseLeave}
504509
onMouseEnter={(e) => handleMouseEnter(move, 'maia', e, prob)}
505510
onClick={(e) => handleClick(move, 'maia', e, prob)}
@@ -521,20 +526,24 @@ export const Highlight: React.FC<Props> = ({
521526
</div>
522527
<div className="flex flex-col items-center justify-start gap-0.5 xl:gap-1">
523528
<div className="flex w-full flex-col border-b border-white/5 py-2">
524-
<p className="whitespace-nowrap text-center text-sm font-semibold text-engine-1 md:text-xxs lg:text-xs">
525-
{useCompactMobileColumnTitles
526-
? mobileStockfishColumnTitle
527-
: 'Stockfish 17'}
529+
<p className="flex items-baseline justify-center gap-1 whitespace-nowrap text-center text-sm font-semibold text-engine-1 md:text-xxs lg:text-xs">
530+
<span>
531+
{useCompactMobileColumnTitles
532+
? mobileStockfishColumnTitle
533+
: 'Stockfish 17'}
534+
</span>
535+
{stockfishDepthLabel && (
536+
<span className="text-[10px] font-normal text-engine-2/75 md:text-[9px] lg:text-[10px]">
537+
{stockfishDepthLabel}
538+
</span>
539+
)}
528540
</p>
529541
</div>
530542

531543
{!hideStockfishEvalSummary && (
532544
<div className="flex w-full flex-row items-center justify-between border-b border-white/5 px-2 py-1 md:flex-col md:items-center md:justify-start md:py-0.5 lg:py-1">
533545
<p className="whitespace-nowrap text-sm font-semibold text-engine-2 md:text-xxs lg:text-xs">
534-
SF Eval{' '}
535-
{moveEvaluation?.stockfish?.depth
536-
? ` (d${moveEvaluation.stockfish?.depth})`
537-
: ''}
546+
SF Eval
538547
</p>
539548
<p className="text-sm font-bold text-engine-1 md:text-sm lg:text-lg">
540549
{isCurrentPositionCheckmate
@@ -577,10 +586,13 @@ export const Highlight: React.FC<Props> = ({
577586
return (
578587
<button
579588
key={index}
580-
className="flex w-full cursor-pointer items-center justify-between hover:underline"
581-
style={{
582-
color: colorSanMapping[move]?.color ?? '#fff',
583-
}}
589+
className="flex w-full cursor-pointer items-center justify-between text-engine-1 hover:underline"
590+
style={
591+
colorSanMapping[move]?.color &&
592+
colorSanMapping[move].color !== '#FFF'
593+
? { color: colorSanMapping[move].color }
594+
: undefined
595+
}
584596
onMouseLeave={handleMouseLeave}
585597
onMouseEnter={(e) =>
586598
handleMouseEnter(

src/constants/analysis.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export const MOVE_CLASSIFICATION_THRESHOLDS = {
2020
export const DEFAULT_MAIA_MODEL = 'maia_kdd_1500' as const
2121
export const MIN_STOCKFISH_DEPTH = 12 as const
2222
export const LEARN_FROM_MISTAKES_DEPTH = 12 as const
23+
export const STOCKFISH_DEBUG_RERUN_EVENT = 'maia:stockfish-debug-rerun' as const
24+
export const STOCKFISH_DEBUG_RERUN_KEY = 'maia.stockfishDebugRerunTs' as const
2325

2426
export const COLORS = {
2527
good: ['#238b45', '#41ab5d', '#74c476', '#90D289', '#AEDFA4'],

0 commit comments

Comments
 (0)