// File: fredericmarchand[P]TexasHoldem/NodeState.cpp
// Function: NodeState::NodeState(Game*, Player*)
NodeState::NodeState(Game *game1, Player *player1)
{
	game = new Game(game1);
	player = game->getPlayers()[game1->getPlayerIndex(player1)];

	flopNull = false;
	turnNull = false;
	riverNull = false;
	if (game->getFlop()[0] == NULL)
		flopNull = true;
	if (game->getTurn() == NULL)
		turnNull = true;
	if (game->getRiver() == NULL)
		riverNull = true;

	game->setupAIGame(this->player);

	moves.push_back(FOLD);

	if (game->getNextPlayer(player)->getChipCount() >= 100 && player->getChipCount() >= 100)	//BET/RAISE
	{
		moves.push_back(BET);
	}

	if (game->getPreviousPlayer(player)->getState().bet > player->getState().bet)	
	{
		if (player->getChipCount() >= game->getPreviousPlayer(player)->getState().bet)
		{
			moves.push_back(CHECK);	//CALL
		}
	}
	else //CHECK
	{
		moves.push_back(CHECK);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x68(%rbp)
addq $0x10, %rdi
movq %rdi, -0x60(%rbp)
callq 0x7170
movl $0x1e0, %edi            # imm = 0x1E0
callq 0x2190
movq %rax, -0x58(%rbp)
jmp 0x8eac
movq -0x58(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x4800
jmp 0x8ebb
movq -0x68(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rcx, (%rax)
movq (%rax), %rdi
callq 0x4a00
movq %rax, -0x70(%rbp)
jmp 0x8ed4
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5000
movl %eax, -0x74(%rbp)
jmp 0x8ee6
movq -0x68(%rbp), %rax
movq -0x70(%rbp), %rcx
movl -0x74(%rbp), %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movq %rcx, 0x8(%rax)
movb $0x0, 0x28(%rax)
movb $0x0, 0x29(%rax)
movb $0x0, 0x2a(%rax)
movq (%rax), %rdi
callq 0x63f0
movq %rax, -0x80(%rbp)
jmp 0x8f16
movq -0x80(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x8f5a
movq -0x68(%rbp), %rax
movb $0x1, 0x28(%rax)
jmp 0x8f5a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x9158
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x1e0, %esi            # imm = 0x1E0
callq 0x21a0
jmp 0x9158
movq -0x68(%rbp), %rax
movq (%rax), %rdi
callq 0x6410
movq %rax, -0x88(%rbp)
jmp 0x8f6f
movq -0x88(%rbp), %rax
cmpq $0x0, %rax
jne 0x8f84
movq -0x68(%rbp), %rax
movb $0x1, 0x29(%rax)
movq -0x68(%rbp), %rax
movq (%rax), %rdi
callq 0x6430
movq %rax, -0x90(%rbp)
jmp 0x8f99
movq -0x90(%rbp), %rax
cmpq $0x0, %rax
jne 0x8fae
movq -0x68(%rbp), %rax
movb $0x1, 0x2a(%rax)
movq -0x68(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x6450
jmp 0x8fc0
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
movl $0x0, -0x28(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x9800
jmp 0x8fda
movq -0x68(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x4eb0
movq %rax, -0x98(%rbp)
jmp 0x8ff3
movq -0x98(%rbp), %rdi
callq 0x3250
movl %eax, -0x9c(%rbp)
jmp 0x9007
movl -0x9c(%rbp), %eax
cmpl $0x64, %eax
jl 0x904e
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3250
movl %eax, -0xa0(%rbp)
jmp 0x9027
movl -0xa0(%rbp), %eax
cmpl $0x64, %eax
jl 0x904e
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
movl $0x2, -0x2c(%rbp)
leaq -0x2c(%rbp), %rsi
callq 0x9800
jmp 0x904c
jmp 0x904e
movq -0x68(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x4f50
movq %rax, -0xa8(%rbp)
jmp 0x9067
movq -0xa8(%rbp), %rdi
callq 0x3690
movq %rax, -0xb0(%rbp)
jmp 0x907c
movq -0x68(%rbp), %rax
movq -0xb0(%rbp), %rcx
movq %rcx, -0x34(%rbp)
movl -0x30(%rbp), %ecx
movl %ecx, -0xbc(%rbp)
movq 0x8(%rax), %rdi
callq 0x3690
movq %rax, -0xb8(%rbp)
jmp 0x90a6
movl -0xbc(%rbp), %eax
movq -0xb8(%rbp), %rcx
movq %rcx, -0x3c(%rbp)
cmpl -0x38(%rbp), %eax
jle 0x9133
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3250
movl %eax, -0xc0(%rbp)
jmp 0x90d1
movq -0x68(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x4f50
movq %rax, -0xc8(%rbp)
jmp 0x90ea
movq -0xc8(%rbp), %rdi
callq 0x3690
movq %rax, -0xd0(%rbp)
jmp 0x90ff
movl -0xc0(%rbp), %eax
movq -0xd0(%rbp), %rcx
movq %rcx, -0x44(%rbp)
cmpl -0x40(%rbp), %eax
jl 0x9131
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
movl $0x1, -0x48(%rbp)
leaq -0x48(%rbp), %rsi
callq 0x9800
jmp 0x912f
jmp 0x9131
jmp 0x914f
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
movl $0x1, -0x4c(%rbp)
leaq -0x4c(%rbp), %rsi
callq 0x9800
jmp 0x914d
jmp 0x914f
addq $0xd0, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x73e0
movq -0x20(%rbp), %rdi
callq 0x22a0
nopw (%rax,%rax)