// File: kobanium[P]Ray/src/mcts/UctRating.cpp
// Function: InputUCTParameter()
void
InputUCTParameter(void)
{
  std::string uct_parameters_path = GetWorkingDirectory() + PATH_SEPARATOR + "uct_params" + PATH_SEPARATOR;
  std::string path;

  // 劫があるときの特徴
  path = uct_parameters_path + "KoExist.txt";
  InputBTFMParameter(path.c_str(), &uct_ko_exist, 1);

  // パス
  path = uct_parameters_path + "Pass.txt";
  InputBTFMParameter(path.c_str(), uct_pass, UCT_PASS_MAX);

  // 戦術的特徴
  path = uct_parameters_path + "CaptureFeature.txt";
  InputBTFMParameter(path.c_str(), uct_capture, UCT_CAPTURE_MAX);
  path = uct_parameters_path + "SaveExtensionFeature.txt";
  InputBTFMParameter(path.c_str(), uct_save_extension, UCT_SAVE_EXTENSION_MAX);
  path = uct_parameters_path + "AtariFeature.txt";
  InputBTFMParameter(path.c_str(), uct_atari, UCT_ATARI_MAX);
  path = uct_parameters_path + "ExtensionFeature.txt";
  InputBTFMParameter(path.c_str(), uct_extension, UCT_EXTENSION_MAX);
  path = uct_parameters_path + "DameFeature.txt";
  InputBTFMParameter(path.c_str(), uct_dame, UCT_DAME_MAX);
  path = uct_parameters_path + "ConnectionFeature.txt";
  InputBTFMParameter(path.c_str(), uct_connect, UCT_CONNECT_MAX);
  path = uct_parameters_path + "ThrowInFeature.txt";
  InputBTFMParameter(path.c_str(), uct_throw_in, UCT_THROW_IN_MAX);

  /*
  for (int i = 0; i < UCT_CAPTURE_MAX; i++) {
    fm_t &feature = uct_capture[i];
    std::cerr << feature.w;
    for (int j = 0; j < BTFM_DIMENSION; j++) {
      std::cerr << " " << feature.v[j];
    }
    std::cerr << std::fixed << std::endl;
  }
  */

  // 盤上の位置
  path = uct_parameters_path + "PosID.txt";
  InputBTFMParameter(path.c_str(), uct_pos_id, POS_ID_MAX);

  // 着手距離
  path = uct_parameters_path + "MoveDistance1.txt";
  InputBTFMParameter(path.c_str(), uct_move_distance_1, MOVE_DISTANCE_MAX * 4);
  path = uct_parameters_path + "MoveDistance2.txt";
  InputBTFMParameter(path.c_str(), uct_move_distance_2, MOVE_DISTANCE_MAX * 4);
  path = uct_parameters_path + "MoveDistance3.txt";
  InputBTFMParameter(path.c_str(), uct_move_distance_3, MOVE_DISTANCE_MAX * 4);
  path = uct_parameters_path + "MoveDistance4.txt";
  InputBTFMParameter(path.c_str(), uct_move_distance_4, MOVE_DISTANCE_MAX * 4);

  //  3x3パターン
  path = uct_parameters_path + "Pat3.txt";
  InputPat3(path.c_str(), uct_pat3);
  //  マンハッタン距離2のパターン
  path = uct_parameters_path + "MD2.txt";
  InputMD2(path.c_str(), uct_md2);
  //  マンハッタン距離3のパターン
  path = uct_parameters_path + "MD3.txt";
  InputLargePattern(path.c_str(), uct_md3, md3_index);
  //  マンハッタン距離4のパターン
  path = uct_parameters_path + "MD4.txt";
  InputLargePattern(path.c_str(), uct_md4, md4_index);
  //  マンハッタン距離5のパターン
  path = uct_parameters_path + "MD5.txt";
  InputLargePattern(path.c_str(), uct_md5, md5_index);

  //  Owner
  for (int i = 0; i < OWNER_MAX; i++) {
    uct_owner[i] = owner_k * exp(-pow(i - 5, 2) / owner_bias);
  }

  //  Criticality
  for (int i = 0; i < CRITICALITY_MAX; i++) {
    uct_criticality[i] = exp(criticality_bias * i);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x460, %rsp            # imm = 0x460
leaq -0x80(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x2ccc0
movq -0x320(%rbp), %rsi
leaq 0x80a6a2f(%rip), %rdx   # 0x812bfb8
leaq -0x60(%rbp), %rdi
callq 0x632c0
jmp 0x85594
leaq 0x29b75(%rip), %rdx     # 0xaf110
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x63310
jmp 0x855aa
leaq 0x80a6a07(%rip), %rdx   # 0x812bfb8
leaq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x632c0
jmp 0x855c0
leaq -0x40(%rbp), %rdi
callq 0x7ae8
leaq -0x60(%rbp), %rdi
callq 0x7ae8
leaq -0x80(%rbp), %rdi
callq 0x7ae8
leaq -0xb0(%rbp), %rdi
callq 0x7770
leaq 0x28be5(%rip), %rdx     # 0xae1d3
leaq -0xd0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85600
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x328(%rbp)
leaq -0xd0(%rbp), %rsi
movq %rsi, -0x330(%rbp)
callq 0x76b0
movq -0x330(%rbp), %rdi
callq 0x7ae8
movq -0x328(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x1aac6bcd(%rip), %rsi  # 0x1ab4c210
movl $0x1, %edx
callq 0x86cb0
jmp 0x8564f
leaq 0x28a86(%rip), %rdx     # 0xae0dc
leaq -0xf0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85668
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x338(%rbp)
leaq -0xf0(%rbp), %rsi
movq %rsi, -0x340(%rbp)
callq 0x76b0
movq -0x340(%rbp), %rdi
callq 0x7ae8
movq -0x338(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x80a72a5(%rip), %rsi   # 0x812c950
movl $0x2, %edx
callq 0x86cb0
jmp 0x856b7
leaq 0x28a27(%rip), %rdx     # 0xae0e5
leaq -0x110(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x856d0
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x348(%rbp)
leaq -0x110(%rbp), %rsi
movq %rsi, -0x350(%rbp)
callq 0x76b0
movq -0x350(%rbp), %rdi
callq 0x7ae8
movq -0x348(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x80aa29d(%rip), %rsi   # 0x812f9b0
movl $0x1b, %edx
callq 0x86cb0
jmp 0x8571f
leaq 0x289d2(%rip), %rdx     # 0xae0f8
leaq -0x130(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85738
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x358(%rbp)
leaq -0x130(%rbp), %rsi
movq %rsi, -0x360(%rbp)
callq 0x76b0
movq -0x360(%rbp), %rdi
callq 0x7ae8
movq -0x358(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x80aa745(%rip), %rsi   # 0x812fec0
movl $0x5, %edx
callq 0x86cb0
jmp 0x85787
leaq 0x28983(%rip), %rdx     # 0xae111
leaq -0x150(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x857a0
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x368(%rbp)
leaq -0x150(%rbp), %rsi
movq %rsi, -0x370(%rbp)
callq 0x76b0
movq -0x370(%rbp), %rdi
callq 0x7ae8
movq -0x368(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x80aa7cd(%rip), %rsi   # 0x812ffb0
movl $0x12, %edx
callq 0x86cb0
jmp 0x857ef
leaq 0x28906(%rip), %rdx     # 0xae0fc
leaq -0x170(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85808
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x378(%rbp)
leaq -0x170(%rbp), %rsi
movq %rsi, -0x380(%rbp)
callq 0x76b0
movq -0x380(%rbp), %rdi
callq 0x7ae8
movq -0x378(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x80aaac5(%rip), %rsi   # 0x8130310
movl $0x7, %edx
callq 0x86cb0
jmp 0x85857
leaq 0x288c4(%rip), %rdx     # 0xae122
leaq -0x190(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85870
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x388(%rbp)
leaq -0x190(%rbp), %rsi
movq %rsi, -0x390(%rbp)
callq 0x76b0
movq -0x390(%rbp), %rdi
callq 0x7ae8
movq -0x388(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x80aabad(%rip), %rsi   # 0x8130460
movl $0x5, %edx
callq 0x86cb0
jmp 0x858bf
leaq 0x2893a(%rip), %rdx     # 0xae200
leaq -0x1b0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x858d8
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x398(%rbp)
leaq -0x1b0(%rbp), %rsi
movq %rsi, -0x3a0(%rbp)
callq 0x76b0
movq -0x3a0(%rbp), %rdi
callq 0x7ae8
movq -0x398(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x80aac35(%rip), %rsi   # 0x8130550
movl $0x2, %edx
callq 0x86cb0
jmp 0x85927
leaq 0x28817(%rip), %rdx     # 0xae145
leaq -0x1d0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85940
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x3a8(%rbp)
leaq -0x1d0(%rbp), %rsi
movq %rsi, -0x3b0(%rbp)
callq 0x76b0
movq -0x3b0(%rbp), %rdi
callq 0x7ae8
movq -0x3a8(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x80aac2d(%rip), %rsi   # 0x81305b0
movl $0x2, %edx
callq 0x86cb0
jmp 0x8598f
leaq 0x2880a(%rip), %rdx     # 0xae1a0
leaq -0x1f0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x859a8
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x3b8(%rbp)
leaq -0x1f0(%rbp), %rsi
movq %rsi, -0x3c0(%rbp)
callq 0x76b0
movq -0x3c0(%rbp), %rdi
callq 0x7ae8
movq -0x3b8(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0xf0aac25(%rip), %rsi   # 0xf130610
movl $0x40, %edx
callq 0x86cb0
jmp 0x859f7
leaq 0x2875a(%rip), %rdx     # 0xae158
leaq -0x210(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85a10
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x3c8(%rbp)
leaq -0x210(%rbp), %rsi
movq %rsi, -0x3d0(%rbp)
callq 0x76b0
movq -0x3d0(%rbp), %rdi
callq 0x7ae8
movq -0x3c8(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x80a6f5d(%rip), %rsi   # 0x812c9b0
movl $0x40, %edx
callq 0x86cb0
jmp 0x85a5f
leaq 0x28704(%rip), %rdx     # 0xae16a
leaq -0x230(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85a78
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x3d8(%rbp)
leaq -0x230(%rbp), %rsi
movq %rsi, -0x3e0(%rbp)
callq 0x76b0
movq -0x3e0(%rbp), %rdi
callq 0x7ae8
movq -0x3d8(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x80a7af5(%rip), %rsi   # 0x812d5b0
movl $0x40, %edx
callq 0x86cb0
jmp 0x85ac7
leaq 0x286ae(%rip), %rdx     # 0xae17c
leaq -0x250(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85ae0
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x3e8(%rbp)
leaq -0x250(%rbp), %rsi
movq %rsi, -0x3f0(%rbp)
callq 0x76b0
movq -0x3f0(%rbp), %rdi
callq 0x7ae8
movq -0x3e8(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x80a868d(%rip), %rsi   # 0x812e1b0
movl $0x40, %edx
callq 0x86cb0
jmp 0x85b2f
leaq 0x28658(%rip), %rdx     # 0xae18e
leaq -0x270(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85b48
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x3f8(%rbp)
leaq -0x270(%rbp), %rsi
movq %rsi, -0x400(%rbp)
callq 0x76b0
movq -0x400(%rbp), %rdi
callq 0x7ae8
movq -0x3f8(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x80a9225(%rip), %rsi   # 0x812edb0
movl $0x40, %edx
callq 0x86cb0
jmp 0x85b97
leaq 0x2860c(%rip), %rdx     # 0xae1aa
leaq -0x290(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85bb0
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x408(%rbp)
leaq -0x290(%rbp), %rsi
movq %rsi, -0x410(%rbp)
callq 0x76b0
movq -0x410(%rbp), %rdi
callq 0x7ae8
movq -0x408(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x1a7c661d(%rip), %rsi  # 0x1a84c210
callq 0x86e40
jmp 0x85bfa
leaq 0x285b2(%rip), %rdx     # 0xae1b3
leaq -0x2b0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85c13
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x418(%rbp)
leaq -0x2b0(%rbp), %rsi
movq %rsi, -0x420(%rbp)
callq 0x76b0
movq -0x420(%rbp), %rdi
callq 0x7ae8
movq -0x418(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x179ff9ba(%rip), %rsi  # 0x17a85610
callq 0x86fe0
jmp 0x85c5d
leaq 0x28557(%rip), %rdx     # 0xae1bb
leaq -0x2d0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85c76
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x428(%rbp)
leaq -0x2d0(%rbp), %rsi
movq %rsi, -0x430(%rbp)
callq 0x76b0
movq -0x430(%rbp), %rdi
callq 0x7ae8
movq -0x428(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x14c38d57(%rip), %rsi  # 0x14cbea10
leaq 0xc0aa950(%rip), %rdx   # 0xc130610
callq 0x871a0
jmp 0x85cc7
leaq 0x284f5(%rip), %rdx     # 0xae1c3
leaq -0x2f0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85ce0
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x438(%rbp)
leaq -0x2f0(%rbp), %rsi
movq %rsi, -0x440(%rbp)
callq 0x76b0
movq -0x440(%rbp), %rdi
callq 0x7ae8
movq -0x438(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0x11e720ed(%rip), %rsi  # 0x11ef7e10
leaq 0xd0aa8e6(%rip), %rdx   # 0xd130610
callq 0x871a0
jmp 0x85d31
leaq 0x28493(%rip), %rdx     # 0xae1cb
leaq -0x310(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x63360
jmp 0x85d4a
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x448(%rbp)
leaq -0x310(%rbp), %rsi
movq %rsi, -0x450(%rbp)
callq 0x76b0
movq -0x450(%rbp), %rdi
callq 0x7ae8
movq -0x448(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
leaq 0xf0ab483(%rip), %rsi   # 0xf131210
leaq 0xe0aa87c(%rip), %rdx   # 0xe130610
callq 0x871a0
jmp 0x85d9b
movl $0x0, -0x314(%rbp)
cmpl $0xb, -0x314(%rbp)
jge 0x85eb9
movsd 0x61c26(%rip), %xmm0    # 0xe79e0
movsd %xmm0, -0x458(%rbp)
movl -0x314(%rbp), %eax
subl $0x5, %eax
cvtsi2sd %eax, %xmm0
movsd 0x28b49(%rip), %xmm1    # 0xae920
callq 0x7990
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
divsd 0x61bdd(%rip), %xmm0    # 0xe79d8
callq 0x79d0
movaps %xmm0, %xmm1
movsd -0x458(%rbp), %xmm0
mulsd %xmm1, %xmm0
movslq -0x314(%rbp), %rcx
leaq 0x80a6a03(%rip), %rax   # 0x812c820
movsd %xmm0, (%rax,%rcx,8)
movl -0x314(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x314(%rbp)
jmp 0x85da5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x85e82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x85e79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x7ae8
leaq -0x60(%rbp), %rdi
callq 0x7ae8
leaq -0x80(%rbp), %rdi
callq 0x7ae8
jmp 0x85f27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x7ae8
leaq -0x20(%rbp), %rdi
callq 0x7ae8
jmp 0x85f27
movl $0x0, -0x318(%rbp)
cmpl $0x19, -0x318(%rbp)
jge 0x85f09
movsd 0x61afc(%rip), %xmm0    # 0xe79d0
cvtsi2sdl -0x318(%rbp), %xmm1
mulsd %xmm1, %xmm0
callq 0x79d0
movslq -0x318(%rbp), %rcx
leaq 0x80a698d(%rip), %rax   # 0x812c880
movsd %xmm0, (%rax,%rcx,8)
movl -0x318(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x318(%rbp)
jmp 0x85ec3
leaq -0xb0(%rbp), %rdi
callq 0x7ae8
leaq -0x20(%rbp), %rdi
callq 0x7ae8
addq $0x460, %rsp            # imm = 0x460
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0x79b0
nopw %cs:(%rax,%rax)