added an explicit calculation of board state