For my school project I am creating a game of checkers. I have managed to make the all of it work properly until just now I realized it's possible to have a stalemate where one player is unable to move any pieces. I'm not sure if I'm supposed to post my code here or anything but if I have to please let me know and I will. Thanks!
You have to have some way of analyzing the board and knowing possible legal moves (e.g. pawn can move one forward unless it is blocked by another piece, bishop goes diagonally until it is blocked by piece of same color or enemy piece and so on; keep in mind that you have to filter these in a way to not allow moves which would put you in a check). I assume you have it anyway, because you can't allow player to take illegal move.
When you have list of possible legal moves, just check to see if it is empty (no possible moves) and at the same time player is not in a check (because being in a check without any legal move to make means being in check-mate). And that's all
EDIT:
just now I realized it's possible to have a stalemate
It seems to me that you may have forgotten some other "uncommon" chess rules. Here is a list of what you might want to look at: