Yet Another Novice Tries To Write AGo Program/ Move Undo Data Structure And Algorithm

I gleaned this from Bruce Wilcox's discussion of RiscIgo. He describes his move structure as:

  • Color (1 bit)
  • Location (9 bits)
  • Ko Flag (1 bit)
  • Kill Directions (4 bits)
  • Plus 1 unused bit = 16 bits

What caught my eye is Kill Directions. How can 4 bits be enough information to replace captured stones upon undo? Ah, well of course! You just flood fill starting at the adjacent empty point(s).

[Diagram]
Capture  

W1 is:

  • Color: White
  • Location: B18
  • Ko:no
  • Kill Directions: North (or East), South
[Diagram]
Undo  

To undo this move, just flood fill with opposite color from the North (n) and South (s) points and then empty the location.

[Diagram]
Undo  

Nifty!


Yet Another Novice Tries To Write AGo Program/ Move Undo Data Structure And Algorithm last edited by AshleyF on August 12, 2004 - 08:15
RecentChanges · StartingPoints · About
Edit page ·Search · Related · Page info · Latest diff
[Welcome to Sensei's Library!]
RecentChanges
StartingPoints
About
RandomPage
Search position
Page history
Latest page diff
Partner sites:
Go Teaching Ladder
Goproblems.com
Login / Prefs
Tools
Sensei's Library