Add isWin method to the gridModel. Please check the top of the file, I use #define, so that cast YES = 1 and NO = 0.