Your program cannot make a move which results in a fifty move draw. A fifty move draw can be claimed by either player after fifty moves. The 50th move itself does not result in a draw.sje wrote:If my program makes a move which results in a fifty move draw, should it also send the 1/2-1/2 string immediately afterward? If my program gets a position which is already a fifty move draw, should it: A) move, B) send 1/2-1/2, C) do A then B, or D) do B then A? At present, it just sends a move although this is not a good solution.
Same question as above for threefold, insufficient, and stalemate.
If your program gets a position that already has fifty moves (but not drawn yet because no one claimed it), you can claim it by sending 1/2-1/2, without sending a move.
If your program gets a position that already has 49 moves, and wants to claim draw immediately after the program's move, it should make the move, then claim draw by sending 1/2-1/2.
However, there's a possible race condition if the opponent makes a very fast move between your move and the claim, and by the time xboard processes your claim, the claim is no longer valid (because the opponent made a capture or pawn move). That's why it's recommended to use "offer draw" instead, before sending the move. XBoard will then process the offer as a claim if the position after the move is claimable, and won't give the opponent a chance to inject a move in-between.
Insufficient and stalemates don't need to be claimed. They are always adjudicated since they are hard draws according to FIDE rules. You can always treat them just like checkmates and stop playing afterwards (assuming you use the FIDE rules for insufficient definition).
Basically, if you have to claim in over the board chess, you have to claim in xboard. If you don't have to claim in over the board chess, you don't have to claim in xboard. It's that simple.