added some simple code to detect chessbaord patterns