fixed is_board_empty to match definition

and added a minimal optimization