I have completed a Python program that uses the Stockfish chess engine with rules governed by the ChessBoard Python module. The code allows the user to choose whether to play black or white, has an adjustable skill level, and lets the chess engine look 15 moves deep. The program will also check the legality of each move made and accounts for special moves such as en passant, castling, and pawn promotion. It also checks for stalemates, the 50 move rule, and the three move repetition rule. In its current iteration, the program prints out the board after each move to make sure it is working correctly. Here is a copy of the program for Python 2.7. You must have the Stockfish engine installed as well as the ChessBoard module with the code pointed to the appropriate places. Moves must be entered in algebraic notation with quotes. For example, a typical opening move may be 'e2e4', castling may be 'e1g1', a pawn promotion may be 'e7e8q', and en passant may look like 'e5d6'.
Enjoy!
Enjoy!