Programming this stuff is HARD. There is a reason why the scoring portion of playing a Go game online is still done interactively (each player taking turns marking dead stones)... it is because there are no algorithms as of yet that can do it accurately enough.