pasky / pachi

A fairly strong Go/Baduk/Weiqi playing program
http://pachi.or.cz/
GNU General Public License v2.0
514 stars 117 forks source link

tree_expand_node(): check group suicides #26

Closed lemonsqueeze closed 8 years ago

lemonsqueeze commented 8 years ago

Hi,

I ran into a situation where a group suicide gets into the tree and makes it crash in tree_expand_node() when it considers opponent playing the same move:

assert(c != node_coord(node)); // I have spotted "C3 C3" in some sequence... 

Looks like it doesn't happen normally because of current prior code, but in this case i was playing with a different one which triggered it. Doing fine now with this board_is_valid_play_no_suicide() check in tree_expand_node().

btw i was wondering, is the only reason group suicides are allowed in board.h that it's more expensive to check for them ? (didn't change other board_is_valid_play() calls because of that)

pasky commented 8 years ago

Thanks! I'm a bit curious why is the ko/eyelike logic different, but I'm assuming that it'll do the same thing as before?

The reason why suicides are allowed by default is indeed that it's less expensive. Or at least it used to be, can't vouch for this not being a historical artifact by now.

lemonsqueeze commented 8 years ago

Yes, it's same as before except for group suicides (almost like a mini is_bad_selfatari() in a way). Just noticed we could even drop the board_is_eyelike() check (if board->ko matches we know it's an eye). Shouldn't matter much though, prior code isn't too performance critical i guess...