// File: /workspace/github_cpp_makefile_star2_O2/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 0x16f6(%rip), %rdi      # 0x433e
callq 0x20e0
movq 0x8(%rbx), %rax
cmpq %rax, 0x10(%rbx)
je 0x2c5b
movq %rax, 0x10(%rbx)
leaq 0x8(%rbx), %rax
movq %rax, 0x10(%rsp)
andq $0x0, 0x30(%rbx)
andl $0x0, 0x38(%rbx)
leaq 0x40(%rbx), %r15
pushq $0x1
popq %rax
movl %eax, 0xc(%rsp)
movb $0x1, %r14b
movq 0x434e(%rip), %r13      # 0x6fd0
leaq 0x1427(%rip), %r12      # 0x40b0
testb $0x1, %r14b
je 0x2e74
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
cmpl $0x4, %eax
setne %r14b
jne 0x2d0d
leaq 0x1692(%rip), %rdi      # 0x433e
callq 0x20e0
movq %r13, %rdi
leaq 0x13ce(%rip), %rsi      # 0x4089
callq 0x2130
movq %rax, %rdi
callq 0x20a0
movq %r13, %rdi
leaq 0x13c6(%rip), %rsi      # 0x4098
callq 0x2130
movl 0x30(%rbx), %esi
movq %rax, %rdi
callq 0x2190
movq %rax, %rdi
movq %r12, %rsi
callq 0x2130
movl 0x34(%rbx), %esi
movq %rax, %rdi
callq 0x2190
movq %rax, %rdi
callq 0x20a0
movq %r15, %rdi
callq 0x3608
jmp 0x2c89
movl %eax, %ebp
movq (%rbx), %rax
movq %rbx, %rdi
movl %ebp, %esi
callq *0x18(%rax)
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2ae8
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
movl 0xc(%rsp), %esi
callq 0x2bd0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2b50
movq %rax, 0x28(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
movl %ebp, %esi
callq *0x18(%rax)
movb %al, 0xb(%rsp)
movq 0x10(%rsp), %rdi
leaq 0xb(%rsp), %rsi
callq 0x3678
movq 0x20(%rbx), %rdi
callq 0x2428
movq %r13, %rdi
movq %rax, %rsi
callq 0x2100
movq %rax, %rdi
leaq 0x133d(%rip), %rsi      # 0x40bd
callq 0x2130
movq %rax, %rbp
movq 0x28(%rbx), %rdi
callq 0x2428
movq %rbp, %rdi
movq %rax, %rsi
callq 0x2100
movq %rax, %rdi
leaq 0x1321(%rip), %rsi      # 0x40c7
callq 0x2130
movq %rax, %rdi
callq 0x20a0
movq 0x20(%rbx), %rdi
movq 0x28(%rbx), %rsi
movq (%rdi), %rax
callq *0x10(%rax)
cmpb $0x6c, %al
je 0x2dd2
movzbl %al, %ecx
cmpl $0x77, %ecx
jne 0x2dd7
incl 0x30(%rbx)
jmp 0x2dda
incl 0x34(%rbx)
jmp 0x2dda
incl 0x38(%rbx)
movq (%rbx), %rcx
movsbl %al, %esi
movq %rbx, %rdi
callq *0x20(%rcx)
movq %r13, %rdi
callq 0x20a0
movq %rax, %rdi
leaq 0x12d5(%rip), %rsi      # 0x40cd
callq 0x2130
movq %rax, %rdi
movl 0xc(%rsp), %esi
callq 0x2190
movq %rax, %rdi
leaq 0x12c1(%rip), %rsi      # 0x40d4
callq 0x2130
movl 0x30(%rbx), %esi
movq %rax, %rdi
callq 0x2190
movq %rax, %rdi
movq %r12, %rsi
callq 0x2130
movl 0x34(%rbx), %esi
movq %rax, %rdi
callq 0x2190
movq %rax, %rdi
callq 0x20a0
movq %rax, %rdi
callq 0x20a0
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x2e58
movq (%rdi), %rax
callq *0x8(%rax)
incl 0xc(%rsp)
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x2c89
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x2c89
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop