def transform_root_forks(forks, moves)
      fork_stack = [{ "te" => 0, "moves" => moves }]
      forks.each do |f|
        now_fork = f
        _fork = fork_stack.pop
        _fork = fork_stack.pop while _fork["te"] > now_fork["te"]
        move = _fork["moves"][now_fork["te"] - _fork["te"]]
        move["forks"] ||= []
        move["forks"] << now_fork["moves"]
        fork_stack << _fork
        fork_stack << now_fork
      end
    end
def transform_root_forks(forks, moves)
      fork_stack = [{ "te" => 0, "moves" => moves }]
      forks.each do |f|
        now_fork = f
        _fork = fork_stack.pop
        _fork = fork_stack.pop while _fork["te"] > now_fork["te"]
        move = _fork["moves"][now_fork["te"] - _fork["te"]]
        move["forks"] ||= []
        move["forks"] << now_fork["moves"]
        fork_stack << _fork
        fork_stack << now_fork
      end
    end
transfrom forks to jkf