First, make sure you're doing the procedure properly. For 0-0-0 or Queenside Castling, drag/place your King on c1. Your King should move to c1 and your Rook should automatically move to d1 without you having to touch it.
Second, make sure you can legally castle: no pieces on b1, c1, and d1 squares; your King is not currently in check; your King hasn't moved yet; moving your King through d1 and c1 don't cause him to temporarily be in check.
If the game is preventing you from doing it, either you are not initiating the sequence properly, or you are making an illegal move.
I know how to play and castle but can't make my machine do it in one game - any suggestions