built score checking logic for 3x3 board