Piccolo3000
Programmer
Hello,
I don't know if it's very descriptive I'm writing a chess program in C++ interfaced with tcl/tk for graphics; I'm at the end, but there is a last bug:
when a player put a pawn on the last rank, it promotes in queen, knight, bishop or rook; so I had to show a window to let the choice to the player. It works well, but when the player is choosing his piece, the code go on running and the computer plays before knowing the player's choice !
Here is a schema of my code:
# inside the procedure "play a move", there is:
proc Promotion {
# show window .promotion,
# with commands "SelectPiece .."
}
proc SelectPiece {
# destroy window .promotion
# modify the board and return to the calling procedure
# ("play a move")
}
# back inside "play a move" : return "move is OK"
It seems that the computer executes "return move is OK" before the SelectPiece procedure is over.
Why? And.. What can I do to correct this? I've no idea, I'm beginner in tcl/tk.
Thanks,
Benjamin.
I don't know if it's very descriptive I'm writing a chess program in C++ interfaced with tcl/tk for graphics; I'm at the end, but there is a last bug:
when a player put a pawn on the last rank, it promotes in queen, knight, bishop or rook; so I had to show a window to let the choice to the player. It works well, but when the player is choosing his piece, the code go on running and the computer plays before knowing the player's choice !
Here is a schema of my code:
# inside the procedure "play a move", there is:
proc Promotion {
# show window .promotion,
# with commands "SelectPiece .."
}
proc SelectPiece {
# destroy window .promotion
# modify the board and return to the calling procedure
# ("play a move")
}
# back inside "play a move" : return "move is OK"
It seems that the computer executes "return move is OK" before the SelectPiece procedure is over.
Why? And.. What can I do to correct this? I've no idea, I'm beginner in tcl/tk.
Thanks,
Benjamin.