// File: tewalds[P]morat/hex/agentmcts.cpp
// Function: Morat::Hex::AgentMCTS::AgentMCTS(Morat::Hex::Board const&)
AgentMCTS::AgentMCTS(const Board & b) : Agent(b), pool(this) {
	nodes = 0;
	runs = 0;
	gclimit = 5;

	profile     = false;
	ponder      = false;
//#ifdef SINGLE_THREAD ... make sure only 1 thread
	numthreads  = 1;
	pool.set_num_threads(numthreads);
	maxmem      = 1000*1024*1024;

	msrave      = -2;
	msexplore   = 0;

	explore     = 0;
	parentexplore = false;
	ravefactor  = 500;
	decrrave    = 0;
	knowledge   = true;
	userave     = 1;
	useexplore  = 1;
	fpurgency   = 1;
	rollouts    = 5;
	dynwiden    = 0;
	logdynwiden = (dynwiden ? std::log(dynwiden) : 0);

	shortrave   = false;
	keeptree    = true;
	minimax     = 2;
	visitexpand = 1;
	gcsolved    = 100000;
	longestloss = false;

	localreply  = 5;
	locality    = 5;
	connect     = 20;
	size        = 0;
	bridge      = 100;
	dists       = 0;

	weightedrandom = false;
	rolloutpattern = true;
	lastgoodreply  = false;
	instantwin     = 0;

	for(int i = 0; i < 4096; i++)
		gammas[i] = 1;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq 0x40(%rsp), %rdi
movq %rdi, 0x18(%rsp)
movq 0x38(%rsp), %rsi
callq 0x1b560
movq 0x18(%rsp), %rdi
leaq 0x54c4a(%rip), %rax     # 0x6c858
movq %rax, (%rdi)
addq $0x40e0, %rdi           # imm = 0x40E0
movq %rdi, 0x20(%rsp)
callq 0x1b5a0
jmp 0x17c24
movq 0x18(%rsp), %rdi
addq $0x4130, %rdi           # imm = 0x4130
movq %rdi, 0x10(%rsp)
callq 0x1b620
jmp 0x17c3c
movq 0x18(%rsp), %rsi
movq %rsi, %rdi
addq $0x54f0, %rdi           # imm = 0x54F0
movq %rdi, 0x8(%rsp)
callq 0x1b6b0
jmp 0x17c57
movq 0x18(%rsp), %rax
movq $0x0, 0x4110(%rax)
movq $0x0, 0x4120(%rax)
movl $0x5, 0x4118(%rax)
movb $0x0, 0x68(%rax)
movb $0x0, 0x58(%rax)
movl $0x1, 0x5c(%rax)
movq %rax, %rdi
addq $0x54f0, %rdi           # imm = 0x54F0
movl 0x5c(%rax), %esi
callq 0x1b770
jmp 0x17c9f
movq 0x18(%rsp), %rax
movq $0x3e800000, 0x60(%rax) # imm = 0x3E800000
vmovss 0x35564(%rip), %xmm0    # 0x4d218
vmovss %xmm0, 0x6c(%rax)
vpxor %xmm0, %xmm0, %xmm0
vmovss %xmm0, 0x70(%rax)
vpxor %xmm0, %xmm0, %xmm0
vmovss %xmm0, 0x78(%rax)
movb $0x0, 0x74(%rax)
vmovss 0x3553d(%rip), %xmm0    # 0x4d214
vmovss %xmm0, 0x7c(%rax)
vpxor %xmm0, %xmm0, %xmm0
vmovss %xmm0, 0x80(%rax)
movb $0x1, 0x84(%rax)
vmovss 0x35519(%rip), %xmm0    # 0x4d210
vmovss %xmm0, 0x88(%rax)
vmovss 0x35509(%rip), %xmm0    # 0x4d210
vmovss %xmm0, 0x8c(%rax)
vmovss 0x354f9(%rip), %xmm0    # 0x4d210
vmovss %xmm0, 0x90(%rax)
movl $0x5, 0x94(%rax)
vpxor %xmm0, %xmm0, %xmm0
vmovss %xmm0, 0x98(%rax)
vmovss 0x98(%rax), %xmm0
vpxor %xmm1, %xmm1, %xmm1
vucomiss %xmm1, %xmm0
jne 0x17d4b
jp 0x17d4b
jmp 0x17d72
movq 0x18(%rsp), %rax
vmovss 0x98(%rax), %xmm0
callq 0x1b9a0
vmovss %xmm0, 0x4(%rsp)
jmp 0x17d65
vmovss 0x4(%rsp), %xmm0
vmovss %xmm0, (%rsp)
jmp 0x17d7d
vpxor %xmm0, %xmm0, %xmm0
vmovss %xmm0, (%rsp)
jmp 0x17d7d
movq 0x18(%rsp), %rax
vmovss (%rsp), %xmm0
vmovss %xmm0, 0x9c(%rax)
movb $0x0, 0xa0(%rax)
movb $0x1, 0xa1(%rax)
movl $0x2, 0xa4(%rax)
movl $0x1, 0xa8(%rax)
movl $0x186a0, 0xac(%rax)    # imm = 0x186A0
movb $0x0, 0xb0(%rax)
movl $0x5, 0xb4(%rax)
movl $0x5, 0xb8(%rax)
movl $0x14, 0xbc(%rax)
movl $0x0, 0xc0(%rax)
movl $0x64, 0xc4(%rax)
movl $0x0, 0xc8(%rax)
movl $0x0, 0xcc(%rax)
movb $0x1, 0xd0(%rax)
movl $0x0, 0xd4(%rax)
movl $0x0, 0xd8(%rax)
movl $0x0, 0x28(%rsp)
cmpl $0x1000, 0x28(%rsp)     # imm = 0x1000
jge 0x17ea7
movq 0x18(%rsp), %rax
movslq 0x28(%rsp), %rcx
vmovss 0x353c9(%rip), %xmm0    # 0x4d210
vmovss %xmm0, 0xdc(%rax,%rcx,4)
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x17e2b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
jmp 0x17ec0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
jmp 0x17eb6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
jmp 0x17eac
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
callq 0x1b9c0
jmp 0x17eac
addq $0x48, %rsp
retq
movq 0x10(%rsp), %rdi
callq 0x1ba30
movq 0x20(%rsp), %rdi
callq 0x1bab0
movq 0x18(%rsp), %rdi
callq 0x1e390
movq 0x30(%rsp), %rdi
callq 0x5760
nopw %cs:(%rax,%rax)