// File: Juan313[P]RockPaperScissor/play_game.cpp
// Function: main
int main()
{
// human tool choice
  char humanChoice; 
// computer tool choice
  char computerChoice; 
  RPSGame* game;
/*******************************
   hr: human rock strength
   hp: human paper strength
   hs: human scissor strength
   cr: computer rock strength
   cp: computer paper strength
   cs: computer scissor strength
**********************************************************/
  int hr,hp,hs,cr,cp,cs;

  // 'n' if the strength for all the tools are 1; 'y' if use customized strength 
  char strengthChoice = Menu::customizeStrength();

  if (strengthChoice =='y')
  {
    // initialized game with all customized strength 
    Menu::getStrength(hr,hp,hs,cr,cp,cs);
    game = new RPSGame(hr,hp,hs,cr,cp,cs);
    std::cout<<"initialized game with customized strength "<<std::endl;
    
    std::cout<<"human rock strength is "<<hr <<std::endl;
    std::cout<<"human paper strength is "<<hp <<std::endl;
    std::cout<<"human scissor strength is "<<hs <<std::endl;
    std::cout<<"computer rock strength is "<<cr <<std::endl;
    std::cout<<"computer paper strength is "<<cp <<std::endl;
    std::cout<<"computer scissor strength is "<<cs <<std::endl;
  }
  else 
  {
    // initialized game with all tools strength equal to 1
    game = new RPSGame(1,1,1,1,1,1);
    std::cout<<"initialized game with all tools strength equal to 1"<<std::endl;
  }

  humanChoice = Menu::getChoice();
  while (humanChoice != 'e') 
  {
    std::string toolName;
    computerChoice = game->computerChoice();
    toolName = getFullName(computerChoice);
    std::cout<<"Computer chose "<<toolName<<std::endl;
    int result = game->play(humanChoice, computerChoice);
    //std::cout << "RESULT: " << result << std::endl;
    if (result == 1) 
    { 
      std::cout<<"Human wins!"<<std::endl; 
    }
    if (result == 2) 
    { 
      std::cout<<"Computer wins!"<<std::endl; 
    }
    if (result == 3) 
    { 
      std::cout<<"It's a tie!"<<std::endl; 
    }
    // display score so far. Need to interface with RPSGame
    game->print_stats();
    humanChoice = Menu::getChoice();
    
  }
  std::cout<<"Thanks for playing. Goodbye! "<<std::endl;
  delete game;
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movl $0x0, -0x4(%rbp)
callq 0x4820
movb %al, -0x29(%rbp)
movsbl -0x29(%rbp), %eax
cmpl $0x79, %eax
jne 0x4c7f
leaq -0x14(%rbp), %rdi
leaq -0x18(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
leaq -0x20(%rbp), %rcx
leaq -0x24(%rbp), %r8
leaq -0x28(%rbp), %r9
callq 0x48e0
movl $0x48, %edi
callq 0x2180
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x90(%rbp)
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %r8d
movl -0x24(%rbp), %r9d
movl -0x28(%rbp), %r10d
movq %rsp, %rax
movl %r10d, (%rax)
callq 0x2b00
jmp 0x4b1d
movq -0x90(%rbp), %rax
movq %rax, -0x10(%rbp)
movq 0x44a1(%rip), %rdi      # 0x8fd0
leaq 0x1761(%rip), %rsi      # 0x6297
callq 0x2170
movq %rax, %rdi
movq 0x447b(%rip), %rsi      # 0x8fc0
callq 0x21a0
movq 0x447f(%rip), %rdi      # 0x8fd0
leaq 0x176a(%rip), %rsi      # 0x62c2
callq 0x2170
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x2260
movq %rax, %rdi
movq 0x444e(%rip), %rsi      # 0x8fc0
callq 0x21a0
movq 0x4452(%rip), %rdi      # 0x8fd0
leaq 0x1755(%rip), %rsi      # 0x62da
callq 0x2170
movq %rax, %rdi
movl -0x18(%rbp), %esi
callq 0x2260
movq %rax, %rdi
movq 0x4421(%rip), %rsi      # 0x8fc0
callq 0x21a0
movq 0x4425(%rip), %rdi      # 0x8fd0
leaq 0x1741(%rip), %rsi      # 0x62f3
callq 0x2170
movq %rax, %rdi
movl -0x1c(%rbp), %esi
callq 0x2260
movq %rax, %rdi
movq 0x43f4(%rip), %rsi      # 0x8fc0
callq 0x21a0
movq 0x43f8(%rip), %rdi      # 0x8fd0
leaq 0x172f(%rip), %rsi      # 0x630e
callq 0x2170
movq %rax, %rdi
movl -0x20(%rbp), %esi
callq 0x2260
movq %rax, %rdi
movq 0x43c7(%rip), %rsi      # 0x8fc0
callq 0x21a0
movq 0x43cb(%rip), %rdi      # 0x8fd0
leaq 0x171d(%rip), %rsi      # 0x6329
callq 0x2170
movq %rax, %rdi
movl -0x24(%rbp), %esi
callq 0x2260
movq %rax, %rdi
movq 0x439a(%rip), %rsi      # 0x8fc0
callq 0x21a0
movq 0x439e(%rip), %rdi      # 0x8fd0
leaq 0x170c(%rip), %rsi      # 0x6345
callq 0x2170
movq %rax, %rdi
movl -0x28(%rbp), %esi
callq 0x2260
movq %rax, %rdi
movq 0x436d(%rip), %rsi      # 0x8fc0
callq 0x21a0
jmp 0x4d09
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x48, %esi
callq 0x2190
jmp 0x4f37
movl $0x48, %edi
callq 0x2180
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x98(%rbp)
movq %rsp, %rax
movl $0x1, (%rax)
movl $0x1, %r9d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x2b00
jmp 0x4cb8
movq -0x98(%rbp), %rax
movq %rax, -0x10(%rbp)
movq 0x4306(%rip), %rdi      # 0x8fd0
leaq 0x1692(%rip), %rsi      # 0x6363
callq 0x2170
movq %rax, %rdi
movq 0x42e0(%rip), %rsi      # 0x8fc0
callq 0x21a0
jmp 0x4d09
movq -0x98(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x48, %esi
callq 0x2190
jmp 0x4f37
callq 0x4a10
movb %al, -0x5(%rbp)
movsbl -0x5(%rbp), %eax
cmpl $0x65, %eax
je 0x4edc
leaq -0x60(%rbp), %rdi
callq 0x2200
movq -0x10(%rbp), %rdi
callq 0x2a40
movb %al, -0x99(%rbp)
jmp 0x4d38
movb -0x99(%rbp), %al
movb %al, -0x6(%rbp)
movsbl -0x6(%rbp), %esi
leaq -0x80(%rbp), %rdi
callq 0x4f40
jmp 0x4d50
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
movq %rsi, -0xb0(%rbp)
callq 0x21d0
movq -0xb0(%rbp), %rdi
callq 0x20d0
movq 0x4259(%rip), %rdi      # 0x8fd0
leaq 0x1619(%rip), %rsi      # 0x6397
callq 0x2170
movq %rax, -0xa8(%rbp)
jmp 0x4d8c
movq -0xa8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x2140
movq %rax, -0xb8(%rbp)
jmp 0x4da5
movq -0xb8(%rbp), %rdi
movq 0x420d(%rip), %rsi      # 0x8fc0
callq 0x21a0
jmp 0x4dba
movq -0x10(%rbp), %rdi
movsbl -0x5(%rbp), %esi
movsbl -0x6(%rbp), %edx
callq 0x2dd0
movl %eax, -0xbc(%rbp)
jmp 0x4dd3
movl -0xbc(%rbp), %eax
movl %eax, -0x84(%rbp)
cmpl $0x1, -0x84(%rbp)
jne 0x4e35
movq 0x41e1(%rip), %rdi      # 0x8fd0
leaq 0x15b1(%rip), %rsi      # 0x63a7
callq 0x2170
movq %rax, -0xc8(%rbp)
jmp 0x4e04
movq -0xc8(%rbp), %rdi
movq 0x41ae(%rip), %rsi      # 0x8fc0
callq 0x21a0
jmp 0x4e19
jmp 0x4e35
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x20d0
jmp 0x4f37
cmpl $0x2, -0x84(%rbp)
jne 0x4e71
movq 0x418b(%rip), %rdi      # 0x8fd0
leaq 0x1567(%rip), %rsi      # 0x63b3
callq 0x2170
movq %rax, -0xd0(%rbp)
jmp 0x4e5a
movq -0xd0(%rbp), %rdi
movq 0x4158(%rip), %rsi      # 0x8fc0
callq 0x21a0
jmp 0x4e6f
jmp 0x4e71
cmpl $0x3, -0x84(%rbp)
jne 0x4ead
movq 0x414f(%rip), %rdi      # 0x8fd0
leaq 0x153a(%rip), %rsi      # 0x63c2
callq 0x2170
movq %rax, -0xd8(%rbp)
jmp 0x4e96
movq -0xd8(%rbp), %rdi
movq 0x411c(%rip), %rsi      # 0x8fc0
callq 0x21a0
jmp 0x4eab
jmp 0x4ead
movq -0x10(%rbp), %rdi
callq 0x2f50
jmp 0x4eb8
callq 0x4a10
movb %al, -0xd9(%rbp)
jmp 0x4ec5
movb -0xd9(%rbp), %al
movb %al, -0x5(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x20d0
jmp 0x4d11
movq 0x40ed(%rip), %rdi      # 0x8fd0
leaq 0x14e4(%rip), %rsi      # 0x63ce
callq 0x2170
movq %rax, %rdi
movq 0x40c7(%rip), %rsi      # 0x8fc0
callq 0x21a0
movq -0x10(%rbp), %rax
movq %rax, -0xe8(%rbp)
cmpq $0x0, %rax
je 0x4f2c
movq -0xe8(%rbp), %rdi
callq 0x2d10
movq -0xe8(%rbp), %rdi
movl $0x48, %esi
callq 0x2190
xorl %eax, %eax
addq $0xf0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x2270