// File: tewalds[P]morat/havannah/agentmcts.cpp
// Function: Morat::Havannah::AgentMCTS::AgentMCTS(Morat::Havannah::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    = 200;
	knowledge   = true;
	userave     = 1;
	useexplore  = 1;
	fpurgency   = 1;
	rollouts    = 1;
	dynwiden    = 0;
	logdynwiden = (dynwiden ? std::log(dynwiden) : 0);

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

	localreply  = 0;
	locality    = 0;
	connect     = 20;
	size        = 0;
	bridge      = 25;
	dists       = 0;

	weightedrandom = false;
	checkringdepth = 1000;
	ringperm       = 0;
	rolloutpattern = false;
	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 0x1b700
movq 0x18(%rsp), %rdi
leaq 0x56b1a(%rip), %rax     # 0x6e858
movq %rax, (%rdi)
addq $0x4140, %rdi           # imm = 0x4140
movq %rdi, 0x20(%rsp)
callq 0x1b740
jmp 0x17d54
movq 0x18(%rsp), %rdi
addq $0x4190, %rdi           # imm = 0x4190
movq %rdi, 0x10(%rsp)
callq 0x1b7c0
jmp 0x17d6c
movq 0x18(%rsp), %rsi
movq %rsi, %rdi
addq $0x5550, %rdi           # imm = 0x5550
movq %rdi, 0x8(%rsp)
callq 0x1b850
jmp 0x17d87
movq 0x18(%rsp), %rax
movq $0x0, 0x4170(%rax)
movq $0x0, 0x4180(%rax)
movl $0x5, 0x4178(%rax)
movb $0x0, 0xc0(%rax)
movb $0x0, 0xb0(%rax)
movl $0x1, 0xb4(%rax)
movq %rax, %rdi
addq $0x5550, %rdi           # imm = 0x5550
movl 0xb4(%rax), %esi
callq 0x1b910
jmp 0x17ddb
movq 0x18(%rsp), %rax
movq $0x3e800000, 0xb8(%rax) # imm = 0x3E800000
vmovss 0x37441(%rip), %xmm0    # 0x4f234
vmovss %xmm0, 0xc4(%rax)
vpxor %xmm0, %xmm0, %xmm0
vmovss %xmm0, 0xc8(%rax)
vpxor %xmm0, %xmm0, %xmm0
vmovss %xmm0, 0xd0(%rax)
movb $0x0, 0xcc(%rax)
vmovss 0x3740e(%rip), %xmm0    # 0x4f230
vmovss %xmm0, 0xd4(%rax)
vmovss 0x373fa(%rip), %xmm0    # 0x4f22c
vmovss %xmm0, 0xd8(%rax)
movb $0x1, 0xdc(%rax)
vmovss 0x373df(%rip), %xmm0    # 0x4f228
vmovss %xmm0, 0xe0(%rax)
vmovss 0x373cf(%rip), %xmm0    # 0x4f228
vmovss %xmm0, 0xe4(%rax)
vmovss 0x373bf(%rip), %xmm0    # 0x4f228
vmovss %xmm0, 0xe8(%rax)
movl $0x1, 0xec(%rax)
vpxor %xmm0, %xmm0, %xmm0
vmovss %xmm0, 0xf0(%rax)
vmovss 0xf0(%rax), %xmm0
vpxor %xmm1, %xmm1, %xmm1
vucomiss %xmm1, %xmm0
jne 0x17e9d
jp 0x17e9d
jmp 0x17ec4
movq 0x18(%rsp), %rax
vmovss 0xf0(%rax), %xmm0
callq 0x1bb40
vmovss %xmm0, 0x4(%rsp)
jmp 0x17eb7
vmovss 0x4(%rsp), %xmm0
vmovss %xmm0, (%rsp)
jmp 0x17ecf
vpxor %xmm0, %xmm0, %xmm0
vmovss %xmm0, (%rsp)
jmp 0x17ecf
movq 0x18(%rsp), %rax
vmovss (%rsp), %xmm0
vmovss %xmm0, 0xf4(%rax)
movb $0x0, 0xf8(%rax)
movb $0x1, 0xf9(%rax)
movl $0x2, 0xfc(%rax)
movb $0x0, 0x100(%rax)
movl $0x1, 0x104(%rax)
movl $0x186a0, 0x108(%rax)   # imm = 0x186A0
movb $0x0, 0x10c(%rax)
movl $0x0, 0x110(%rax)
movl $0x0, 0x114(%rax)
movl $0x14, 0x118(%rax)
movl $0x0, 0x11c(%rax)
movl $0x19, 0x120(%rax)
movl $0x0, 0x124(%rax)
movl $0x0, 0x128(%rax)
vmovss 0x372cf(%rip), %xmm0    # 0x4f238
vmovss %xmm0, 0x12c(%rax)
movl $0x0, 0x130(%rax)
movb $0x0, 0x134(%rax)
movl $0x0, 0x138(%rax)
movl $0x0, 0x13c(%rax)
movl $0x0, 0x28(%rsp)
cmpl $0x1000, 0x28(%rsp)     # imm = 0x1000
jge 0x1801a
movq 0x18(%rsp), %rax
movslq 0x28(%rsp), %rcx
vmovss 0x3726e(%rip), %xmm0    # 0x4f228
vmovss %xmm0, 0x140(%rax,%rcx,4)
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x17f9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
jmp 0x18033
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
jmp 0x18029
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
jmp 0x1801f
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
callq 0x1bb60
jmp 0x1801f
addq $0x48, %rsp
retq
movq 0x10(%rsp), %rdi
callq 0x1bbd0
movq 0x20(%rsp), %rdi
callq 0x1bc50
movq 0x18(%rsp), %rdi
callq 0x1e560
movq 0x30(%rsp), %rdi
callq 0x5770
nopw (%rax,%rax)