[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: computer-go: Empty board spaces management



Hi Bryan.

I use a 'Territory' class with several instances, updated at each stone
added/removed.

Each Terrritory has among others two usefull methods : chainAdded and
chainRemoved (it has also stoneAdded and StoneRemoved methods, called when the
concerned stone is not a 1-stone chain) The latter is for instance called when a
chain is captured or when undoing a move. 

Receiving chainAdded, a Territory t checks wether it is concerned (the stones is
inside t), and if yes it checks if this could result in a split in 2, 3 or even
four parts :

     o o . o @ if a stone is added at '1' point, the 5 intersections territory
     o . 1 . @ will be splitted in four parts
     @ @ . o *
     
Receiving chainRemoved, a territory checks if this could result in a join with
one or more Territories. This is a bit complicated, but not too much.

I decided that is was better for a territory to receive those messages AFTER the
board was updated.

What IS complicated, is to decide what these territories objects could be used
for : after having created thoses classes, I tried to get some "shape" property
from territories, so as to quickly find which ones have a monochromatic
frontier, and among them which ones are eyes, which ones are dead, and so on.
But usually, a territory has some stones/chains "embedded" within it, and some
others that are its "frontier". I've found that deciphering witch chains are
"inside" and which are "frontier" is very complicated... I reached kind of dead
line here : I was not able to solve this problem.

 | . . . o . . |  Which stones are "inside" and which ones are "frontier" ?
 | . o . . . . |  Maybe the 7-stones black chain is the frontier and
 | . o o . o o |  all others are inside ?
 | . . @ @ @ o |  Maybe only the white isolated stone at top is "inside"
 | o . o o o @ |  and all other chains are "frontier ?" (other solutions exists)
 | @ @ @ @ @ @ |  I would prefer the first solution... but how to have the
program
                  check for that ?

-- 
  _______________________________
 / The reasonable man tries to   \
 | adapt himself to the world.   |
 | The unreasonable man tries to |
 | adapt the world to himself.   |
 |Therefore all progress depends |         \\\|/// 
 \__on_the_unreasonable_man...___/  O    \\  ^ ^  // 
                                      o o (  @ @  ) 
 +--------------------------------------oOOo-(_)-oOOo----+
 |  Serge Boisse                                         |
 |  SERVICE TECHNIQUE DE LA NAVIGATION AERIENNE (STNA)   |
 |  ODS FRANCE project, http://www.stna.dgac.fr/phidias  |
 |  tel: (0)562 14 5731      mailto:boisse@xxxxxxxxxxxxxxxxx  |
 |  homepages: http://www.multimania.com/boisse          |
 |  and:       http://www.multimania.com/unitedplanet    |
 +-----------------------------------------------Oooo----+ 
                                         oooO   (   ) 
                                         (   )   ) / 
                                          \ (   (_/ 
                                           \_)