Search

Thursday, September 6, 2012

Day 29: Suicidal rule

Until now I was filtering possible moves by two things:


  • Spaces with a 0 (Empty)
  • There is no Ko
But, there are other spaces that could be not allowed to be played, let's see suicidal rule:


In most common ruleset, suicide is forbidden, so for now it will be for my program (maybe some day I will do something for the other rulesets).

So, there is how I will implement it:

  1. The number of liberties of the group if I play this move == 0?
  2. If not, move is allowed
  3. if yes, try to kill groups of the other color.
  4. If kills, move is allowed
  5. if not, this is a suicide move and can't be played.
I just created a method to see if a move is suicide (this is my first aproach, not tested yet):



Maybe tomorrow I will continue coding, or today if I have some time (I wish I can). 

No comments:

Post a Comment