@@ -138,7 +138,11 @@ - (IBAction)toggleUseNnue:(id)sender {
138138 [SFMUserDefaults setUseNnue: ![SFMUserDefaults useNnue ]];
139139 self.engine .useNnue = [SFMUserDefaults useNnue ];
140140}
141+ - (IBAction )toggleShowWdl : (id )sender {
142+ [SFMUserDefaults setShowWDL: ![SFMUserDefaults showWdl ]];
143+ self.engine .showWdl = [SFMUserDefaults showWdl ];
141144
145+ }
142146#pragma mark - Helper methods
143147- (void )syncToViewsAndEngine
144148{
@@ -224,7 +228,7 @@ - (void)windowDidLoad
224228 self.engine = [[SFMUCIEngine alloc ] initStockfish ];
225229 self.engine .delegate = self;
226230 self.engine .useNnue = [SFMUserDefaults useNnue ];
227-
231+ self. engine . showWdl = [SFMUserDefaults showWdl ];
228232 [self handlePGNFile ];
229233}
230234
@@ -304,6 +308,8 @@ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem
304308 [menuItem setState: [SFMUserDefaults arrowsEnabled ] ? NSControlStateValueOn : NSControlStateValueOff ];
305309 } else if ([menuItem action ] == @selector (toggleUseNnue: )) {
306310 [menuItem setState: [SFMUserDefaults useNnue ] ? NSControlStateValueOn : NSControlStateValueOff ];
311+ } else if ([menuItem action ] == @selector (toggleShowWdl: )) {
312+ [menuItem setState: [SFMUserDefaults showWdl ] ? NSControlStateValueOn : NSControlStateValueOff ];
307313 }
308314 return YES ;
309315}
@@ -389,12 +395,17 @@ - (void)uciEngine:(SFMUCIEngine *)engine didGetNewLine:(NSDictionary *)lines {
389395 if (line.tbHits ) {
390396 [statusComponents addObject: [NSString stringWithFormat: @" TB=%lu " , line.tbHits]];
391397 }
392-
398+
393399 // 4. Time
394400 [statusComponents addObject: [SFMFormatter millisecondsToClock: line.time]];
395401
396402 // 5. Nodes
397403 [statusComponents addObject: [SFMFormatter nodesAsText: line.nodes]];
404+
405+ // 6. WDL
406+ if (engine.showWdl ) {
407+ [statusComponents addObject: [NSString stringWithFormat: @" \n Win=%1.1f%% Draw=%1.1f%% Loss=%1.1f%% " , (float )line.wdlWin/10 , (float )line.wdlDraw/10 , (float )line.wdlLoss/10 ]];
408+ }
398409
399410 NSAttributedString *secondLine = [[NSAttributedString alloc ] initWithString: [statusComponents componentsJoinedByString: @" " ] attributes: @{NSFontAttributeName : [NSFont systemFontOfSize: [NSFont systemFontSize ]], NSForegroundColorAttributeName : [NSColor labelColor ]}];
400411
0 commit comments