                                   board_line_right_horizontal"></div>'
   placement = "<div class='placement " + newStoneColor + "'></div>"
   placement = if newStoneColor in ['black', 'white'] then placement else ""
-
 
   tableContentsStr = ''
   for j in [0...size]

    when 19 then row in [3,9,15] and column in [3,9,15]
    when 13 then (row in [3,9] and column in [3,9]) or row == column == 6
    when 9 then (row in [2,6] and column in [2,6]) or row == column == 4

game_common.initialize = (sgf_object, newStoneColor) ->
  $('.goban').remove()
  $('#content').append '<div class="goban"></div>'

  unless sgf_object
    if getInputSgf() != ''
      sgf_object = smartgame.parse getInputSgf()

  size = if sgf_object \
         then parseInt(sgf_object.gameTrees[0].nodes[0].SZ) or 19 \
         else 19

  top_vertical = '<div class="board_line board_line_vertical"></div>'
  bottom_vertical = '<div class="board_line board_line_vertical
                                 board_line_bottom_vertical"></div>'

      row_element += point_element
    row_element += "</div>"
    tableContentsStr += row_element

  $('.goban').remove()
  $('#content').append '<div class="goban">' + tableContentsStr + '</div>'
  return

createScoringDom = ->
  $('.score_block').empty().remove()
  $scoreBlock = $('<div class="score_block"></div>')
  $scoreBlock.append ('<div>Black prisoners: ' +
    '<span class="prisoners black"></span></div>')
  $scoreBlock.append ('<div>White prisoners: ' +
    '<span class="prisoners white"></span></div>')
  $('#content').append $scoreBlock
  return

setupState = (sgf_object) ->
  size = if sgf_object \
         then parseInt(sgf_object.gameTrees[0].nodes[0].SZ) or 19 \
         else 19
  board_state = (('empty' for i in [0...size]) for j in [0...size])
  prisoners = { black: 0, white: 0 }
  for node in sgf_object.gameTrees[0].nodes
    if node.AB
      coords = if Array.isArray(node.AB) then node.AB else [node.AB]
      for coordStr in coords
        [x, y] = decodeSgfCoord coordStr
        board_state[y][x] = 'black'
    if node.AW
      coords = if Array.isArray(node.AW) then node.AW else [node.AW]
      for coordStr in coords
        [x, y] = decodeSgfCoord coordStr
        board_state[y][x] = 'white'
    if node.B
      [x, y] = decodeSgfCoord node.B
      result = go_rules.getNewStateAndCaptures('black', x, y, board_state)
      board_state = result.state
      prisoners.black += result.captures.black
      prisoners.white += result.captures.white
    if node.W
      [x, y] = decodeSgfCoord node.W
      result = go_rules.getNewStateAndCaptures('white', x, y, board_state)
      board_state = result.state
      prisoners.black += result.captures.black
      prisoners.white += result.captures.white
  updateBoard board_state

  $('.prisoners.black').text(prisoners.black)
  $('.prisoners.white').text(prisoners.white)
  return

aCode = 'a'.charCodeAt(0)
