I get that each player gets a point for each stone that is alive, for each empty field in their territory and for each empty field in neither territory, but how exactly is any of this figured out? As far as I understand it, after a game both players agree on which stones are dead and which empty positions count towards which player's territory. This doesn't seem very satisfying.
If I were to write a computer program that is supposed to score a given board state at the end of the game, how would such a machine make these decisions? It can't, can it?
I can see how this would work in case of eyes, as there is no way of placing an opponent's stone there, but for everything bigger then that it seems obscure to me how that decision (black, white, neutral territory) is made.