Ending and counting
The game ends when both players pass — signalling no worthwhile moves remain. Under area scoring (Chinese, the default here) your score is the empty points you surround plus your stones on the board; under territory scoring (Japanese) it's surrounded empty points plus captured stones. Komi (e.g. 7.5) is added to White to compensate for moving second.