This type of error can be hard to find but the program is simple that make live a little easier.FB_Numpty wrote:It's not as simple as the original problem with lower/upper case characters and it doesn't seem to be a problem with movegen function as latest version is perfect on perft for the following position as far as i tested it (to d = 7)
I'm wondering if it is related to WQ/BQ values - in all 3 games by the time of the promotion to a new queen, the original Q had been taken. You're more familiar with this aspect of the coding having made changes, I wonder does it suggest anything obvious to you?8/PPP4k/8/8/8/8/4Kppp/8 w - - 0 1
First thing what comes to mind is that the error look's identical to some error's I have found. When the program can not process the info that it receives or it sends info that the other side can not process this can lead to a forfeit on time. I tested the move generator on some positions to depth 10 in order to see if the moves generated where correct in positions with castling, so it is very unlikely that the move generator is causing this. The part that should keep track of the number of queen's is not working correctly but that has no influence on the game play. I have seen a game where 2 pawn's where promoted to queen (same side). I have not altered that part of the code.
In order to get an idea what could caused this we need to find out whats going on inside the program.
I assume that you used the version that I posted on 23 April.
(I assume that the program end in a normal way by receiving the command "quit" if not or in case of a crash the code needs to changed/extended)
To find out what info is send and received by the program we need to put extra code in the program.
At the top of the program place
this will open a file named error????.txt where ???? is the integer part of the timer.Open "error"+Str(Int(Timer))+".txt" For Append As #99
(timer will reset at midnight)
Just under Function SendCommand(sWBCmd As String) As Integer
The text send will be printed between "$$" making spaces easier to spotPrint #99,"$$";swbcmd;"$$"
In Function GetCommand As String between the line GetCommand = sTemp and the line End function insert
This will show the text that the program receives.Print #99,"##";stemp;"##"
In Sub CommandLoop just after the line ElseIf sWBCmd = "quit" Then add
savegame : Close #99
In the version of 23 April there is still the modified version of SaveGame (that I used, forgot to restore it).
Modified version of SaveGame.
Code: Select all
Sub SaveGame
'****************************************
' Writes game details to 'SaveNOmega.DAT'
' routine saves:
' - board position
' - move list
'****************************************
Dim As Integer x, piece
' Dim As UInteger y, ff = FreeFile
Dim As UInteger y, ff = 99
/'
'OPEN "O", 1, "SaveNomega.DAT"
Open "SaveNomega.DAT" For Output As #ff
Print #ff, cmpclr ' ### computer is ???
Print #ff, side ' ### witch side is to play
Print #ff, bookhit ' ### out of book ???
Print #ff, w_cas(1) ' ### is castling allowed
Print #ff, w_cas(2)
Print #ff, b_cas(1)
Print #ff, b_cas(2)
Print #ff, mat_left
Print #ff, endgame
For X = 90 To 20 Step -10
For Y = X+1 To X+8
Print #ff, B(Y)
Next Y
Next X
If moveno = 0 Then moveno = 1 '###
Print #ff, MoveNo
For y = 1 To MoveNo
Print #ff, move_hist(y, 1), move_hist(y, 2), move_hist(y, 3), move_hist(y, 4)
Next y
'/
Print #ff,
Print #ff, "//////////////////////////////////////////"
Print #ff,
For X = 90 To 20 Step -10
For Y = X+1 To X+8
piece = B(y)
If piece < 0 Then piece += 20
Print #ff, " "; b_str(piece); ' u_str(Y) ;
Next Y
Print #ff, " *** ";(X \ 10) - 1
Print #ff, " -----------------------------"
Next X
Print #ff, " *********************************** "
Print #ff, " *********************************** "
Print #ff, " a b c d e f g h "
Print #ff,
Print #ff, "Move White Black"
For y = 1 To MoveNo
Print #ff, Using " ###"; y;
Print #ff, " "; move_2_str(move_hist(y, 1)); "-"; move_2_str(move_hist(y, 2));
If move_hist(y, 3) = 0 Then Exit For
Print #ff, " "; move_2_str(move_hist(y, 3)); "-"; move_2_str(move_hist(y, 4))
Next y
Close #ff
End Sub
It's a quick way to see what goes on.
P.S.
I have updated the version, it now has the original SaveGame routine.