// File: 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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
callq 0x3880
movq -0x20(%rbp), %rdi
movl $0x1, -0xc(%rbp)
addq $0x8, %rdi
callq 0x4460
movq -0x20(%rbp), %rax
movb $0x1, -0xd(%rbp)
movl $0x0, 0x30(%rax)
movl $0x0, 0x34(%rax)
movl $0x0, 0x38(%rax)
testb $0x1, -0xd(%rbp)
je 0x3878
movq -0x20(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movl %eax, -0x14(%rbp)
cmpl $0x4, -0x14(%rbp)
jne 0x367b
movq -0x20(%rbp), %rdi
callq 0x3880
movb $0x0, -0xd(%rbp)
movq 0x59d1(%rip), %rdi      # 0x8fd0
leaq 0x2a57(%rip), %rsi      # 0x605d
callq 0x2160
movq %rax, %rdi
movq 0x59ab(%rip), %rsi      # 0x8fc0
callq 0x2190
movq 0x59af(%rip), %rdi      # 0x8fd0
leaq 0x2a44(%rip), %rsi      # 0x606c
callq 0x2160
movq %rax, %rdi
movq -0x20(%rbp), %rax
movl 0x30(%rax), %esi
callq 0x2200
movq %rax, %rdi
leaq 0x2a3e(%rip), %rsi      # 0x6084
callq 0x2160
movq %rax, %rdi
movq -0x20(%rbp), %rax
movl 0x34(%rax), %esi
callq 0x2200
movq %rax, %rdi
movq 0x595c(%rip), %rsi      # 0x8fc0
callq 0x2190
movq -0x20(%rbp), %rdi
addq $0x40, %rdi
callq 0x4480
jmp 0x3873
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %esi
movq (%rdi), %rax
callq *0x18(%rax)
movq -0x20(%rbp), %rdi
movsbl %al, %esi
callq 0x3220
movq -0x20(%rbp), %rdi
movq %rax, 0x20(%rdi)
movl -0xc(%rbp), %esi
callq 0x34c0
movq -0x20(%rbp), %rdi
movsbl %al, %esi
callq 0x3350
movq -0x20(%rbp), %rdi
movq %rax, 0x28(%rdi)
movq %rdi, %rax
addq $0x8, %rax
movq %rax, -0x30(%rbp)
movl -0x14(%rbp), %esi
movq (%rdi), %rax
callq *0x18(%rax)
movq -0x30(%rbp), %rdi
movb %al, -0x16(%rbp)
leaq -0x16(%rbp), %rsi
callq 0x4530
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x2720
movq %rax, %rsi
movq 0x58dd(%rip), %rdi      # 0x8fd0
callq 0x2130
movq %rax, %rdi
leaq 0x298f(%rip), %rsi      # 0x6091
callq 0x2160
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, -0x28(%rbp)
movq 0x28(%rax), %rdi
callq 0x2720
movq -0x28(%rbp), %rdi
movq %rax, %rsi
callq 0x2130
movq %rax, %rdi
leaq 0x296a(%rip), %rsi      # 0x609b
callq 0x2160
movq %rax, %rdi
movq 0x5880(%rip), %rsi      # 0x8fc0
callq 0x2190
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdi
movq 0x28(%rax), %rsi
movq (%rdi), %rax
callq *0x10(%rax)
movb %al, -0x15(%rbp)
movsbl -0x15(%rbp), %eax
cmpl $0x77, %eax
jne 0x3772
movq -0x20(%rbp), %rax
movl 0x30(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x30(%rax)
jmp 0x3799
movsbl -0x15(%rbp), %eax
cmpl $0x6c, %eax
jne 0x378a
movq -0x20(%rbp), %rax
movl 0x34(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x34(%rax)
jmp 0x3797
movq -0x20(%rbp), %rax
movl 0x38(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x38(%rax)
jmp 0x3799
movq -0x20(%rbp), %rdi
movb -0x15(%rbp), %cl
movq (%rdi), %rax
movsbl %cl, %esi
callq *0x20(%rax)
movq 0x5820(%rip), %rdi      # 0x8fd0
movq 0x5809(%rip), %rsi      # 0x8fc0
callq 0x2190
movq %rax, %rdi
leaq 0x28db(%rip), %rsi      # 0x60a1
callq 0x2160
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x2200
movq %rax, %rdi
leaq 0x28c8(%rip), %rsi      # 0x60a8
callq 0x2160
movq %rax, %rdi
movq -0x20(%rbp), %rax
movl 0x30(%rax), %esi
callq 0x2200
movq %rax, %rdi
leaq 0x2886(%rip), %rsi      # 0x6084
callq 0x2160
movq %rax, %rdi
movq -0x20(%rbp), %rax
movl 0x34(%rax), %esi
callq 0x2200
movq %rax, %rdi
movq 0x57a4(%rip), %rsi      # 0x8fc0
callq 0x2190
movq %rax, %rdi
movq 0x5795(%rip), %rsi      # 0x8fc0
callq 0x2190
movq -0x20(%rbp), %rax
movl -0xc(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0xc(%rbp)
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x3855
movq -0x38(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x3871
movq -0x40(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x3873
jmp 0x35ca
addq $0x40, %rsp
popq %rbp
retq
nop