improved state.score() function implemented