official-pikafish / Pikafish

UCI xiangqi engine
http://pikafish.com
GNU General Public License v3.0
940 stars 172 forks source link

[CLI] Replace white/white side with red/red side in human facing texts #32

Closed Klamath233 closed 1 year ago

Klamath233 commented 1 year ago

Describe the issue

The upstream engine is designed for Chess where there's a white side and black side, while CC uses a red/black palette. While it's reasonable to keep the white/black terms in code to make pulling upstream changes or rebasing easier, it makes the console interface more intuitive for CC players to adopt red/black terms in user-facing texts.

For example:

eval
info string NNUE evaluation using pikafish.nnue enabled

 NNUE derived piece values:
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|   r   |   n   |   b   |   a   |   k   |   a   |   b   |   n   |   r   |
| -6.70 | -2.83 | -0.93 | -0.85 |       | -0.89 | -1.12 | -2.77 | -6.48 |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|       |       |       |       |       |       |       |       |       |
|       |       |       |       |       |       |       |       |       |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|       |   c   |       |       |       |       |       |   c   |       |
|       | -3.99 |       |       |       |       |       | -3.84 |       |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|   p   |       |   p   |       |   p   |       |   p   |       |   p   |
| +0.18 |       | -0.19 |       | -1.03 |       | -0.32 |       | -0.02 |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|       |       |       |       |       |       |       |       |       |
|       |       |       |       |       |       |       |       |       |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|       |       |       |       |       |       |       |       |       |
|       |       |       |       |       |       |       |       |       |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|   P   |       |   P   |       |   P   |       |   P   |       |   P   |
| -0.15 |       | +0.20 |       | +0.69 |       | +0.31 |       | +0.05 |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|       |   C   |       |       |       |       |       |   C   |       |
|       | +3.74 |       |       |       |       |       | +3.67 |       |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|       |       |       |       |       |       |       |       |       |
|       |       |       |       |       |       |       |       |       |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|   R   |   N   |   B   |   A   |   K   |   A   |   B   |   N   |   R   |
| +7.01 | +2.69 | +1.00 | +0.86 |       | +0.93 | +1.17 | +2.74 | +6.81 |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+

 NNUE network contributions (White to move)
+------------+------------+------------+------------+
|   Bucket   |  Material  | Positional |   Total    |
|            |   (PSQT)   |  (Layers)  |            |
+------------+------------+------------+------------+
|  0         |     0.00   |  +  0.64   |  +  0.64   |
|  1         |     0.00   |  -  0.82   |  -  0.82   |
|  2         |     0.00   |  +  0.95   |  +  0.95   |
|  3         |     0.00   |  +  0.53   |  +  0.53   |
|  4         |     0.00   |  +  0.19   |  +  0.19   |
|  5         |     0.00   |  +  0.25   |  +  0.25   |
|  6         |     0.00   |  +  0.20   |  +  0.20   |
|  7         |     0.00   |  +  0.32   |  +  0.32   | <-- this bucket is used
+------------+------------+------------+------------+

NNUE evaluation        +0.32 (white side)
Final evaluation       +0.42 (white side) [with scaled NNUE, optimism, ...]

The term "white side" should be "red side" in CC context.

Expected behavior

White/white side should be replaced with red/red side in user-facing texts.

Steps to reproduce

startpos
eval

Anything else?

No response

Operating system

All

Pikafish version

26f3659

PikaCat-OuO commented 1 year ago

I think one key factor that left the White concept in this program is that the current FEN notation system, no matter whether standard UCI or UCI-CYCLONE, uses w for the red side to move. e.g. rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR w - - 0 1. In addition to that, almost all GUI uses w for red to move in FEN recognition, so if we need to change this behavior, the FEN notation may need some changes too IMO.

Klamath233 commented 1 year ago

You are right. I didn't intend to change the terms in code/FEN, but just the console texts output via cout.

PikaCat-OuO commented 1 year ago

You are right. I didn't intend to change the terms in code/FEN, but just the console texts output via cout.

What I mean by that is FEN is also user facing text, like:

d

 +---+---+---+---+---+---+---+---+---+
 | r | n | b | a | k | a | b | n | r | 9
 +---+---+---+---+---+---+---+---+---+
 |   |   |   |   |   |   |   |   |   | 8
 +---+---+---+---+---+---+---+---+---+
 |   | c |   |   |   |   |   | c |   | 7
 +---+---+---+---+---+---+---+---+---+
 | p |   | p |   | p |   | p |   | p | 6
 +---+---+---+---+---+---+---+---+---+
 |   |   |   |   |   |   |   |   |   | 5
 +---+---+---+---+---+---+---+---+---+
 |   |   |   |   |   |   |   |   |   | 4
 +---+---+---+---+---+---+---+---+---+
 | P |   | P |   | P |   | P |   | P | 3
 +---+---+---+---+---+---+---+---+---+
 |   | C |   |   |   |   |   | C |   | 2
 +---+---+---+---+---+---+---+---+---+
 |   |   |   |   |   |   |   |   |   | 1
 +---+---+---+---+---+---+---+---+---+
 | R | N | B | A | K | A | B | N | R | 0
 +---+---+---+---+---+---+---+---+---+
   a   b   c   d   e   f   g   h   i

Fen: rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR w - - 0 1
Key: FDA3193C470C785C
Checkers:

Also eval and d are labeled as non-UCI commands, they are not intended to be used by regular xiangqi players, you can find this in the readme.md: For developers the following non-standard commands might be of interest, mainly useful for debugging:

Klamath233 commented 1 year ago

I see your point now. Thanks! I’ll just accept this as part of learning curve :)