def sgf_iter_states(sgf_string, include_end=True):
 collection = sgf.parse(sgf_string)
 game = collection[0]
 gs = _sgf_init_gamestate(game.root)
 if (game.rest is not None):
  for node in game.rest:
   props = node.properties
   if ('W' in props):
    move = _parse_sgf_move(props['W'][0])
    player = go.WHITE
   elif ('B' in props):
    move = _parse_sgf_move(props['B'][0])
    player = go.BLACK
   (yield (gs, move, player))
   gs.do_move(move, player)
 if include_end:
  (yield (gs, None, None))

def sgf_iter_states ( sgf_string , include_end = True ) : collection = sgf . parse ( sgf_string ) game = collection [ 0 ] gs = _sgf_init_gamestate ( game . root ) if ( game . rest is not None ) : for node in game . rest : props = node . properties if ( 'W' in props ) : move = _parse_sgf_move ( props [ 'W' ] [ 0 ] ) player = go . WHITE elif ( 'B' in props ) : move = _parse_sgf_move ( props [ 'B' ] [ 0 ] ) player = go . BLACK ( yield ( gs , move , player ) ) gs . do_move ( move , player ) if include_end : ( yield ( gs , None , None ) )
iterates over tuples in the first game of the given sgf file .