// File: /workspace/github_cpp_makefile_star2_O1/LifeAlgorithm[P]RockPaperScissors/RPSGame.cpp
// Function: RPSGame::playGame()
void RPSGame::playGame()
{
	screenClear();
	int currentRound = 1;
	knowledgeBase.clear();
	bool gameRun = true;
	humanWins = 0;
	computerWins = 0;
	ties = 0;
	int tempUserChoice;
	char tempRoundResult;
	//starting new game text
	while (gameRun)
	{
		//cout << "Round " << currentRound << endl;
		tempUserChoice = choiceMenu();
		if (tempUserChoice == 4)
		{
			screenClear();
			gameRun = false;
			cout << "Game ending..." << endl;
			cout << "Final Score:      You: " << humanWins << "  Computer: " << computerWins << endl;
			std::this_thread::sleep_for(sleepDuration);
		}
		else
		{
			humanTool = buildHumanTool(choiceToTool(tempUserChoice));
			computerTool = buildComputerTool(nextAIMove(currentRound));
			knowledgeBase.push_back(choiceToTool(tempUserChoice)); // can also use humanTool.getType()

			cout << humanTool->getLongType() << " (HU) vs " << computerTool->getLongType() << " (PC)" << endl;

			tempRoundResult = humanTool->fight(*computerTool);

			if (tempRoundResult == 'w')
			{
				humanWins++;
			}

			else if (tempRoundResult == 'l')
			{
				computerWins++;
			}

			else //result = 't', tie
			{
				ties++;
			}

			printRoundResult(tempRoundResult);
			cout << endl << "Round " << currentRound << " score:    You: " << humanWins << "  Computer: " << computerWins << endl << endl;

			currentRound++;
			delete humanTool;
			delete computerTool;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x24b0(%rip), %rdi      # 0x533e
callq 0x20b0
movq 0x8(%rbx), %rax
cmpq %rax, 0x10(%rbx)
je 0x2ea1
movq %rax, 0x10(%rbx)
leaq 0x8(%rbx), %rax
movq %rax, (%rsp)
movq $0x0, 0x30(%rbx)
movl $0x0, 0x38(%rbx)
movb $0x1, %r14b
movl $0x1, %ebp
movq 0x5109(%rip), %r12      # 0x7fd0
leaq 0x8(%rsp), %r15
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
cmpl $0x4, %eax
jne 0x2fca
leaq 0x2459(%rip), %rdi      # 0x533e
callq 0x20b0
movl $0xe, %edx
movq %r12, %rdi
leaq 0x2190(%rip), %rsi      # 0x5089
callq 0x2120
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movl $0x17, %edx
movq %r12, %rdi
leaq 0x2163(%rip), %rsi      # 0x5098
callq 0x2120
movl 0x30(%rbx), %esi
movq %r12, %rdi
callq 0x2170
movq %rax, %r13
movl $0xc, %edx
movq %rax, %rdi
leaq 0x2159(%rip), %rsi      # 0x50b0
callq 0x2120
movl 0x34(%rbx), %esi
movq %r13, %rdi
callq 0x2170
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq 0x40(%rbx), %rax
testq %rax, %rax
jle 0x2fc2
movq %rax, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movq %r15, %rdi
movq %r15, %rsi
callq 0x2060
cmpl $-0x1, %eax
jne 0x2fc2
callq 0x2040
cmpl $0x4, (%rax)
je 0x2fa8
xorl %r14d, %r14d
jmp 0x31d7
movl %eax, %r13d
movq (%rbx), %rax
movq %rbx, %rdi
movl %r13d, %esi
callq *0x18(%rax)
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2d0c
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2dfe
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2d78
movq %rax, 0x28(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
movl %r13d, %esi
callq *0x18(%rax)
movb %al, 0x8(%rsp)
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x3ffa
movq 0x20(%rbx), %rdi
callq 0x2414
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r12, %rdi
callq 0x2120
movq %rax, %r13
movl $0x9, %edx
movq %rax, %rdi
leaq 0x2076(%rip), %rsi      # 0x50bd
callq 0x2120
movq 0x28(%rbx), %rdi
callq 0x2414
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r13, %rdi
callq 0x2120
movq %rax, %r13
movl $0x5, %edx
movq %rax, %rdi
leaq 0x2051(%rip), %rsi      # 0x50c7
callq 0x2120
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq 0x20(%rbx), %rdi
movq 0x28(%rbx), %rsi
movq (%rdi), %rax
callq *0x10(%rax)
cmpb $0x6c, %al
je 0x30c2
movzbl %al, %ecx
cmpl $0x77, %ecx
jne 0x30c7
incl 0x30(%rbx)
jmp 0x30ca
incl 0x34(%rbx)
jmp 0x30ca
incl 0x38(%rbx)
movq (%rbx), %rcx
movsbl %al, %esi
movq %rbx, %rdi
callq *0x20(%rcx)
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq %rax, %r13
movl $0x6, %edx
movq %rax, %rdi
leaq 0x1fbd(%rip), %rsi      # 0x50cd
callq 0x2120
movq %r13, %rdi
movl %ebp, %esi
callq 0x2170
movq %rax, %r13
movl $0x10, %edx
movq %rax, %rdi
leaq 0x1fa3(%rip), %rsi      # 0x50d4
callq 0x2120
movl 0x30(%rbx), %esi
movq %r13, %rdi
callq 0x2170
movq %rax, %r13
movl $0xc, %edx
movq %rax, %rdi
leaq 0x1f5d(%rip), %rsi      # 0x50b0
callq 0x2120
movl 0x34(%rbx), %esi
movq %r13, %rdi
callq 0x2170
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x31c6
movq (%rdi), %rax
callq *0x8(%rax)
incl %ebp
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x31d7
movq (%rdi), %rax
callq *0x8(%rax)
testb $0x1, %r14b
jne 0x2ecc
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq