Problem with Bihasa

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Problem with Bihasa

Post by hgm »

There seems to be a problem with Bihasa: The first game after it is loaded it seems to miscalculate the time control, and forfeits on time. The next game it seems to work, but the error is of course fatal in a tournament where the engine is reloaded before every game.

The winboard.debug (edited to leave only the communication with Bihasa) is this:

Code: Select all

StartChildProcess (dir="../Bihasa") Bihasa
549537 >first : xboard
protover 2
549537 <first &#58; # Bihasa 1.0
549537 <first &#58; # Compiled&#58; Sep 17 2011
549537 <first &#58; # Can only play Capablanca and gothic chess variants
549537 <first &#58; 
549537 <first &#58; # Reading initialization file...
549537 <first &#58; 
549537 <first &#58; # Hash		           &#58; 49 Mb
549537 <first &#58; # Eval Cache               &#58; 16 Mb
549537 <first &#58; # Resign                   &#58; OFF
549537 <first &#58; # Resign Score             &#58; -1200
549537 <first &#58; # Resign Score Count       &#58; 5
549537 <first &#58; # Contempt Value           &#58; 0
549537 <first &#58; # Ponder                   &#58; ON
549537 <first &#58; 
549537 <first &#58; # Pawn_Value 100 100
549537 <first &#58; # Knight_Value 315 315
549537 <first &#58; # Bishop_Value 325 325
549537 <first &#58; # Rook_Value 500 500
549537 <first &#58; # ArchBishop_Value 980 980
549537 <first &#58; # Chancellor_Value 1015 1015
549537 <first &#58; # Queen_Value 1150 1150
549537 <first &#58; 
549537 <first &#58; # Closing initialization file...
549537 <first &#58; 
549537 <first &#58; 
549537 <first &#58; 
549599 <first &#58; feature ping=1 time=1 setboard=1 name=1 colors=1
549599 >first &#58; accepted ping
549599 >first &#58; accepted time
549599 >first &#58; accepted setboard
549599 >first &#58; accepted name
549599 >first &#58; accepted colors
549599 <first &#58; feature draw=0 sigint=0 sigterm=0 reuse=0 analyze=1 ics=1
549599 >first &#58; accepted draw
549599 >first &#58; accepted sigint
549599 >first &#58; accepted sigterm
549599 >first &#58; accepted reuse
549599 >first &#58; accepted analyze
549599 >first &#58; accepted ics
549599 <first &#58; feature variants="capablanca, gothic"
549599 >first &#58; accepted variants
549599 <first &#58; feature myname="Bihasa 1.0"
549599 >first &#58; accepted myname
549599 <first &#58; feature done=1
549599 >first &#58; accepted done
549615 >first &#58; new
random
549615 >first &#58; variant capablanca
549615 >first &#58; ics -
549615 >first &#58; level 40 1 0
549615 >first &#58; post
549615 >first &#58; hard
549615 >first &#58; easy
549615 >first &#58; ping 1
549615 >first &#58; force
549615 >first &#58; setboard rnbqckabnr/pppppppppp/10/10/10/10/PPPPPPPPPP/RNBQCKABNR w KQkq - 0 1
549677 <first &#58; # received variant command capablanca
549740 <first &#58; # moves per session = 40
549740 <first &#58; # time per session = 1
549740 <first &#58; # inc per move = 0
549740 <first &#58; # Total Initial Time = 60 sec.
549740 <first &#58; # Conventional Time Control.
549740 <first &#58; # Moves per session = 40 moves.
549740 <first &#58; # Minutes per game = 1.00 min.
549740 <first &#58; # Increment = 0 ms.
549740 <first &#58; pong 1
549802 <first &#58; rnbqckabnr/pppppppppp/10/10/10/10/PPPPPPPPPP/RNBQCKABNR w KQkq -
New game &#40;0&#41;&#58; Bihasa 1.0-Fairy-Max 4.8R &#40;w&#41;
554560 >first &#58; computer
554560 >first &#58; name Fairy-Max 4.8R
554560 >second&#58; computer
554560 >first &#58; black
554560 >first &#58; time 6000
554560 >first &#58; otim 6000
554560 >first &#58; white
554560 >first &#58; go
554560 <first &#58; # TimeLeft=60000.00 ms.  MaxTime=60000.00 ms  AllocatedTime=60000.00 ms.
554560 <first &#58; # ply score  time     nodes Pv line
554560 <first &#58; # -----------------------------------
554560 <first &#58;   1    47      0         32 b1c3
554576 <first &#58;   2     0      0        202 b1c3 b8c6
554576 <first &#58;   3    30      1        309 b1c3
554576 <first &#58;   3    47      1        454 b1c3 b8c6 i1h3
554576 <first &#58;   4     0      1       1020 b1c3 b8c6 i1h3 i8h6 &#40;1.0&#41;
554576 <first &#58;   5    24      1       1482 b1c3 b8c6 i1h3 i8h6 d2d4 &#40;1.0&#41;
554591 <first &#58;   6     0      1       2815 b1c3 b8c6 i1h3 i8h6 d2d4 d7d5 &#40;1.0&#41;
554607 <first &#58;   7    22      1       5682 b1c3 b8c6 i1h3 i8h6 d2d4 g7g6 c1e3 &#40;1.0&#41;
554607 <first &#58;   8    12      3      14765 b1c3 b8c6 i1h3 i8h6 d2d4 g7g6 d4d5 c6d4 &#40;1.9&#41;
554669 <first &#58;   9    16     10      47613 b1c3 b8c6 i1h3 i8h6 d2d4 g7g6 d4d5 c6d4 c1f4 d7d6 &#40;3.5&#41;
555028 <first &#58;  10     0     45     224436 b1c3 b8c6 i1h3 d7d5 d2d4 g7g6 g2g3 h8d4 h1d5 i8h6 &#40;4.2&#41;
555574 <first &#58;  11     8    101     511731 b1c3 i8h6 i1h3 d7d6 g2g3 b8c6 d2d3 c8g4 c1g5 h6i4 g5f4 &#40;2.2&#41;
556058 <first &#58;  12     7    149     756853 b1c3 i8h6 i1h3 d7d6 g2g3 b8c6 d2d3 c8g4 c1g5 h6i4 g5f4 e7e5 j2j3 e5f4 h1c6 &#40;1.5&#41;
557087 <first &#58;  13     7    252    1259429 b1c3 i8h6 i1h3 d7d6 g2g3 b8c6 d2d3 c8g4 c1g5 h6i4 g5f4 e7e5 j2j3 e5f4 h1c6 &#40;1.7&#41;
560504 <first &#58;  14     0    594    2941092 b1c3 i8h6 i1h3 d7d6 g2g3 b8c6 d2d3 g7g6 c1g5 c8f5 h1d5 h6i4 g5f4 h8d4 &#40;2.4&#41;
565262 <first &#58;  15     5   1070    5232875 b1c3 i8h6 i1h3 d7d6 g2g3 b8c6 d2d3 g7g6 h1d5 c6b4 d5f3 h8d4 c1g5 h6i4 g5f4 c7c6 &#40;1.8&#41;
574871 <first &#58;  16     5   2031    9843909 b1c3 i8h6 i1h3 b8c6 g2g3 g7g6 d2d3 a7a6 j2j4 d7d6 c1f4 c8f5 h3g5 e7e5 f4d2 j7j5 &#40;1.9&#41;
593498 <first &#58;  17     6   3893   18663774 b1c3 i8h6 i1h3 b8c6 g2g3 g7g6 d2d3 a7a6 c1f4 d7d6 a2a4 c8f5 h3g5 h8d4 e2e3 d4b6 h1d5 j7j5 &#40;1.9&#41;
614573 >first &#58; result 0-1 &#123;Black wins on time&#125;
614573 >first &#58; quit
As you can see, Behasa just searches until its time 1 min) is up, and never moves. The fact that it says "AllocatedTime=60000 ms" made me suspicious (although previous output clearly suggests it recognized it was in a 40/1 game). So I repeated the test with WinBoard's -autoCallFlag option off (output not shown), and indeed Bihasa produces the first move immediately after it is flagged.

This is the first time I tried Bihasa from a setup position; I don't know if it is related to that. The previous Bihasa tests I did were all gauntlets (from the standard opening position), and there Bihasa did always remain loaded as gauntlet engine, so it could be I missed the error in the first game.

Some other remarks w.r.t. protocol:
*) Please no space before 'gothic' in the variants feature. Current WB does not care, because it matches variant names very sloppily (using strstr(featuredVariants, chosenVariant), so it would even recognize 'pseudogothic' as if the engine played gothic, but formally the space would be part of the variant name.. So when future WB versions would do more strict matching, it would no longer recognize ' gothic' as gothic.

*) You nicely use # to comment out the engine debug output with # to disarm it, but this is only fully effective when you also put debug=1 in the features. (The idea was that when a GUI answers you rejected debug, you know it will not recognize the # as special, and you could refrain from sending such lines. Not terribly important, I admit, because most likely you would want to take the risk and send them anyway.)

*) When you echo the FEN, there is no #.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Problem with Bihasa

Post by Ferdy »

Thanks for this info. I can see now where the problem is, this can occur when a fen set-up is used :x , the TC type was changed when receiving positions from setboard . I have not encountered this since I do my testing from pgn files. I will fix this including those additional comments.
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Problem with Bihasa

Post by hgm »

OK, thanks. I usually also test from PGN, but when you want to play other 10x8 setups like Bird or Carrera, they are not always reachable from the Gothic or Capablanca position through moves. Here the Gothic position is loaded in variant Capablanca, because although Bihasa plays Gothic, some opponents don't. So to let Bihasa play Gothic against such an engine it has to beplayed as Capablanca, setting up the Gothic position.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Problem with Bihasa

Post by Ferdy »

hgm wrote:OK, thanks. I usually also test from PGN, but when you want to play other 10x8 setups like Bird or Carrera, they are not always reachable from the Gothic or Capablanca position through moves. Here the Gothic position is loaded in variant Capablanca, because although Bihasa plays Gothic, some opponents don't. So to let Bihasa play Gothic against such an engine it has to beplayed as Capablanca, setting up the Gothic position.
I released Bihasa v2.0 found here. https://sites.google.com/site/deuterium ... ownloads-1. This will hopefully fixed the bug mentioned.
Changes:

Code: Select all

Bihasa v2.0 &#40;29-Oct-2011&#41;
1. Fixed a bug in time control if a position is setup using setboard command.
2. Fixed a bug where engine will not move under winboard interface if it does not receive a go command even if it received a legal move. This will happen only if engine is set to play as black in a non engine vs engine match.
3. Implemented a fen like book, both for capablanca and gothic chess variants.
4. Modify piece values for archbishops, chancellor and queen via automatic parameter tuning using CLOP by Remi Coulom and cutechess-cli by Ilari Pihlajisto & Arto Jonsson.
5. Added knowledge to win kbn-k ending
6. Added knowledge to draw kq-kp ending when the pawn is in a, c, h, & j files at 7th rank.
7. Added knowledge to draw kbp-k where pawn is a wrong rook-pawn.
8. Added bad bishop penalty in eval where bishop is still at the original location.
9. Modify pawn pcsq - encourage central pawn advance.
10. Modify bihasa.ini file, added Book option to set ON/OFF.
11. Added lazy eval.
12. Tune search pruning and reductions
Here is a 24 game match at TC 40 moves / 2 minutes, ponder off with main hash of 64MB, using 12 starting positions from pgn file, color reversed, done in i7-2600k.

Code: Select all

Player Results&#58;
no.  1. Bihasa v1.0&#58; 6.5 / 24
no.  2. Bihasa v2.0&#58; 17.5 / 24

Rank by score&#58;
no.  1. Bihasa v2.0&#58; 17.5 &#40;72.9%)
no.  2. Bihasa v1.0&#58;  6.5 &#40;27.1%) 
User avatar
George Tsavdaris
Posts: 1627
Joined: Thu Mar 09, 2006 12:35 pm

Re: Problem with Bihasa

Post by George Tsavdaris »

Ferdy wrote: I released Bihasa v2.0 found here. https://sites.google.com/site/deuterium ... ownloads-1. This will hopefully fixed the bug mentioned.
Thanks for that but i have a simple question:
What does each of the 2 values mean in the Material options. E.g:

// Material options ...
// refers to actual value of pieces

// def=990 1006
Queen_Value 990 1006

What does the first value of 990 mean and what the second value of 1006 means?
After his son's birth they've asked him:
"Is it a boy or girl?"
YES! He replied.....
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Problem with Bihasa

Post by Ferdy »

George Tsavdaris wrote:
Ferdy wrote: I released Bihasa v2.0 found here. https://sites.google.com/site/deuterium ... ownloads-1. This will hopefully fixed the bug mentioned.
Thanks for that but i have a simple question:
What does each of the 2 values mean in the Material options. E.g:

// Material options ...
// refers to actual value of pieces

// def=990 1006
Queen_Value 990 1006

What does the first value of 990 mean and what the second value of 1006 means?
Those 2 values will be used to interpolate a final value to be used in the evaluation. When there are no pieces exchanged yet 990 will be used. As pieces come off the board the queen value to be used will approach 1006.
User avatar
George Tsavdaris
Posts: 1627
Joined: Thu Mar 09, 2006 12:35 pm

Re: Problem with Bihasa

Post by George Tsavdaris »

Ferdy wrote:
George Tsavdaris wrote: Thanks for that but i have a simple question:
What does each of the 2 values mean in the Material options. E.g:

// Material options ...
// refers to actual value of pieces

// def=990 1006
Queen_Value 990 1006

What does the first value of 990 mean and what the second value of 1006 means?
Those 2 values will be used to interpolate a final value to be used in the evaluation. When there are no pieces exchanged yet 990 will be used. As pieces come off the board the queen value to be used will approach 1006.
I see, so "Queen_Value 1006 1006" gives a steady Queen value of 1006 during the whole game?

Also with what method exactly, Bihasa changes the value during the course of the game?

Bihasa from one game i observed seems very strong. Perhaps it is the strongest Gothic Chess engine now, even stronger than Gothic Vortex Nuclear Edition 2.2.5 and even stronger than a private engine of CRC 10x8 Chess i had beta testing before some years which was the current top Gothic engine.
I will play a short tournament, with Bihasa, myself and Gothic Vortex 2.2.5. I expect to win easily but it will be interesting to see if Bihasa is stronger than Vortex.

Does Bihasa has a randomizer in its evaluation for the first moves or it is (absolutely) deterministic?

Also how you can use the books? I have in its .ini:
// use book
Book ON

And i have the books in the same folder with Bihasa and yet Bihasa thinks in the opening move(s).
Why?

For me it's also a chance with Bihasa(it was a chance with FairyMax and perhaps Joker i don't remember, but the way of doing that was more complicated and i abandoned the plan to do it) to test my theory that current common knowledge that says Queen value> Chancellor's > Archbishop's in general in middlegame, is way wrong. I rate both 3 these pieces the same in middlegame(and opening of course) and early endgame.

So i will set my values to another executable of Bihasa in a different folder with a different .ini file and match them together with your default values. It's the first time i will see if my theory is solid.

I guess i will test this first and then match Bihasa against me and Vortex.
After his son's birth they've asked him:
"Is it a boy or girl?"
YES! He replied.....
User avatar
George Tsavdaris
Posts: 1627
Joined: Thu Mar 09, 2006 12:35 pm

Re: And some Winboard questions.

Post by George Tsavdaris »

&#9658;Putting Bihasa executable(and books and INI) in the Winboard folder and writing in the INI of the Winboard the:

bihasa2.0.exe /variant=gothic

.....Bihasa runs fine.

But putting instead:
bihasa2.0 /variant=gothic
OR
-fcp "bihasa2.0" /variant=gothic
OR
-fcp "bihasa2.0.exe" /variant=gothic
OR
-fcp="bihasa2.0" /variant=gothic
OR
-fcp="bihasa2.0.exe" /variant=gothic

or without "-" in front of fcp, when i try to run this, Winboard opens and closes instantly.
Why?
What is wrong with "-fcp "bihasa2.0.exe" /variant=gothic" for example? :cry:

----------------------------------------------------
&#9658;Putting Bihasa in a folder named Bihasa2 inside the Winboard folder that contains Winboard.exe and writing in the INI of the Winboard the:

"Bihasa 2.0modified" -fcp="bihasa-2.0.exe" -fd="Bihasa2" -fn="Bihasa 2.0modified" /variant=gothic

......Winboard doesn't even open when i choose this configuration.
•Why?
I tried -fd="..\Bihasa2" but it doesn't work either and obviously should not since Bihasa2 folder that contains the executable is

•Also is there any help guide about the different options you can put on Winboard and what each one means and how it can be used?
I mean all the -fcp, -scp, -fn, -fd. -sd, etc etc that you put in the Winboard.ini what does they mean and how they can be used?

•Is for example -fcp="bihasa-2.0.exe" the same with -fcp "bihasa-2.0.exe"?

•What -fn means?

•What the "some text...." text means in front of the -fcp in the above lines? It is just an indicator for the user or it is being used by Winboard too in some way?

----------------------------------------------------
&#9658;Putting Bihasa in a folder named Bihasa2 inside the Winboard folder that contains Winboard.exe and writing in the INI of the Winboard the:

bihasa-2.0.exe /fd="C:\Program Files\Accessories\WinBoard-4.5.0\WinBoard\Bihasa2" /variant="gothic"

....Bihasa again runs fine.

So why it does not recognize the standard way of the previous methods?


I'm using Winboard 4.20010105 version.
After his son's birth they've asked him:
"Is it a boy or girl?"
YES! He replied.....
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Problem with Bihasa

Post by Ferdy »

I see, so "Queen_Value 1006 1006" gives a steady Queen value of 1006 during the whole game?
That is correct.
Also with what method exactly, Bihasa changes the value during the course of the game?
I just summed up total pieces remaining on the board, this does not include pawns. Something like this
totalPiecesRemaining = 10*(wq+bq) + 9*(wc+bc) + 8*(wa+ba) + 5*(wr+br) + 3*(wb+bb+wn+bn)
c for chancellor and a for archbishop.
totalMaxPieces = 10*2 + 9*2 + 8*2 + 5*4 + 3*8
gamePhase = minimum(totalPiecesRemaining, totalMaxPieces)

To get the value,

Code: Select all

value = &#40;op_value*gamePhase + en_value&#40;totalMaxPieces-gamePhase&#41;)  / totalMaxPieces
op_value = 990
en_value = 1006
Bihasa from one game i observed seems very strong. Perhaps it is the strongest Gothic Chess engine now, even stronger than Gothic Vortex Nuclear Edition 2.2.5 and even stronger than a private engine of CRC 10x8 Chess i had beta testing before some years which was the current top Gothic engine.
I will play a short tournament, with Bihasa, myself and Gothic Vortex 2.2.5. I expect to win easily but it will be interesting to see if Bihasa is stronger than Vortex.
Fine let me know the results then :)
Does Bihasa has a randomizer in its evaluation for the first moves or it is (absolutely) deterministic?
It has a randomizer.
Also how you can use the books? I have in its .ini:
// use book
Book ON

And i have the books in the same folder with Bihasa and yet Bihasa thinks in the opening move(s).
Why?
Strange, under console window it worked (see below). It worked also here under winboard. Note that the book is small, only 26 positions for black. You might have made a move that is not covered in the opening file.

Code: Select all

# Bihasa v2.0
# Compiled&#58; Oct 29 2011
# Can only play Capablanca and gothic chess variants

# Reading initialization file...

# Hash                     &#58; 49 Mb
# Eval Cache               &#58; 16 Mb
# Resign                   &#58; OFF
# Resign Score             &#58; -1200
# Resign Score Count       &#58; 5
# Book                     &#58; ON
# Contempt Value           &#58; 0
# Ponder                   &#58; ON

# Pawn_Value 100 100
# Knight_Value 315 315
# Bishop_Value 325 325
# Rook_Value 500 500
# ArchBishop_Value 850 850
# Chancellor_Value 955 960
# Queen_Value 990 1006

# Closing initialization file...


# Default chess variant is capablanca

# scanning opening book files...

# white.dbk is found!!
# black.dbk is found!!

# end scanning book files....

xboard

new
post
d

8  r n a b q k b c n r
7  o o o o o o o o o o
6  . . . . . . . . . .
5  . . . . . . . . . .
4  . . . . . . . . . .
3  . . . . . . . . . .
2  P P P P P P P P P P
1  R N A B Q K B C N R

   a b c d e f g h i j

rnabqkbcnr/pppppppppp/10/10/10/10/PPPPPPPPPP/RNABQKBCNR w KQkq -

e2e4
# book lines read = 26
# fen line found = 1

# From EPD Book&#58;
# e7e5&#40;1&#41;,
# Book move from epd book
0 0 0 0 &#40;Book Move e7e5&#41;
move e7e5
For me it's also a chance with Bihasa(it was a chance with FairyMax and perhaps Joker i don't remember, but the way of doing that was more complicated and i abandoned the plan to do it) to test my theory that current common knowledge that says Queen value> Chancellor's > Archbishop's in general in middlegame, is way wrong. I rate both 3 these pieces the same in middlegame(and opening of course) and early endgame.
That could be true, because the strength of an engine is not only determined in the piece values of these specific pieces. It is possible to set equal values, then tune other eval features plus tune the search also.
So i will set my values to another executable of Bihasa in a different folder with a different .ini file and match them together with your default values. It's the first time i will see if my theory is solid.
Yes that could be a possible setup.
User avatar
George Tsavdaris
Posts: 1627
Joined: Thu Mar 09, 2006 12:35 pm

Re: And also something more....

Post by George Tsavdaris »

When i set the 2 Bihasa's 2 play each other, the default one against the one with the modified values by me, it's like my modifications of the values doesn't even exist. Bihasa seems to ignore them.

Why does it ignore its INI file? Do i have to put any extra line in Winboard.ini in order Bihasa to use its ini? Something like for example:

"bihasa2.0.exe bihasa.ini" /variant=gothic


It's strange. For example i put the modified Bihasa(the one with Queen, Chancellor and Archbishop values the same) with white and the default Bihasa with black to play from this position:

Image

And the white modified Bihasa reports a +1.40 value because obviously is happy that has traded an Archbishop with a Queen, but it should not be happy as i have set Queen's value the same with Archbishop's for the white player.
So what is going on?

I use in the ini of the white player:

// def=850 850
ArchBishop_Value 990 990

// def=955 960
Chancellor_Value 990 995

// def=990 1006
Queen_Value 990 995
After his son's birth they've asked him:
"Is it a boy or girl?"
YES! He replied.....