// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
callq 0x3164
cmpb $0x79, %al
jne 0x34a6
leaq 0x24(%rsp), %r14
leaq 0x20(%rsp), %r15
leaq 0x1c(%rsp), %r12
leaq 0x18(%rsp), %r13
leaq 0x14(%rsp), %rbp
leaq 0x10(%rsp), %r9
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %rbp, %r8
callq 0x31eb
pushq $0x48
popq %rdi
callq 0x2160
movq %rax, %rbx
movl (%r14), %esi
movl (%r15), %edx
movl (%r12), %ecx
movl (%r13), %r8d
movl (%rbp), %r9d
leaq 0x10(%rsp), %rax
movl (%rax), %eax
movl %eax, (%rsp)
movq %rbx, %rdi
callq 0x26c6
movq 0x3c0d(%rip), %r14      # 0x6fd0
leaq 0xecd(%rip), %rsi       # 0x4297
movq %r14, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x2090
leaq 0xee1(%rip), %rsi       # 0x42c2
movq %r14, %rdi
callq 0x2150
movl 0x24(%rsp), %esi
movq %rax, %rdi
callq 0x2220
movq %rax, %rdi
callq 0x2090
leaq 0xed6(%rip), %rsi       # 0x42da
movq %r14, %rdi
callq 0x2150
movl 0x20(%rsp), %esi
movq %rax, %rdi
callq 0x2220
movq %rax, %rdi
callq 0x2090
leaq 0xecc(%rip), %rsi       # 0x42f3
movq %r14, %rdi
callq 0x2150
movl 0x1c(%rsp), %esi
movq %rax, %rdi
callq 0x2220
movq %rax, %rdi
callq 0x2090
leaq 0xec4(%rip), %rsi       # 0x430e
movq %r14, %rdi
callq 0x2150
movl 0x18(%rsp), %esi
movq %rax, %rdi
callq 0x2220
movq %rax, %rdi
callq 0x2090
leaq 0xebc(%rip), %rsi       # 0x4329
movq %r14, %rdi
callq 0x2150
movl 0x14(%rsp), %esi
movq %rax, %rdi
callq 0x2220
movq %rax, %rdi
callq 0x2090
leaq 0xeb5(%rip), %rsi       # 0x4345
movq %r14, %rdi
callq 0x2150
movl 0x10(%rsp), %esi
movq %rax, %rdi
callq 0x2220
jmp 0x34e0
pushq $0x48
popq %rdi
callq 0x2160
movq %rax, %rbx
movl $0x1, (%rsp)
pushq $0x1
popq %rcx
movq %rax, %rdi
movl %ecx, %esi
movl %ecx, %edx
movl %ecx, %r8d
movl %ecx, %r9d
callq 0x26c6
movq 0x3afc(%rip), %rdi      # 0x6fd0
leaq 0xe88(%rip), %rsi       # 0x4363
callq 0x2150
movq %rax, %rdi
callq 0x2090
callq 0x32e3
movl %eax, %ebp
leaq 0x48(%rsp), %r14
leaq 0x28(%rsp), %r15
movq 0x3ad0(%rip), %r12      # 0x6fd0
cmpb $0x65, %bpl
je 0x35bd
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
andq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
movq %rbx, %rdi
callq 0x2664
movsbl %al, %r13d
movq %r14, %rdi
movl %r13d, %esi
callq 0x3627
movq %r15, %rdi
movq %r14, %rsi
callq 0x2190
movq %r14, %rdi
callq 0x2080
movq %r12, %rdi
leaq 0xe44(%rip), %rsi       # 0x4397
callq 0x2150
movq %rax, %rdi
movq %r15, %rsi
callq 0x2120
movq %rax, %rdi
callq 0x2090
movsbl %bpl, %esi
movq %rbx, %rdi
movl %r13d, %edx
callq 0x2832
decl %eax
cmpl $0x3, %eax
jae 0x35a1
movl %eax, %eax
leaq 0xe76(%rip), %rcx       # 0x4400
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
movq %r12, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x28c4
callq 0x32e3
movl %eax, %ebp
movq %r15, %rdi
callq 0x2080
jmp 0x3500
movq 0x3a0c(%rip), %rdi      # 0x6fd0
leaq 0xe03(%rip), %rsi       # 0x43ce
callq 0x2150
movq %rax, %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x27d2
pushq $0x48
popq %rsi
movq %rbx, %rdi
callq 0x2170
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x35fe
movq %rax, %r14
pushq $0x48
popq %rsi
movq %rbx, %rdi
callq 0x2170
jmp 0x361f
jmp 0x3612
jmp 0x3612
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x2080
movq %r14, %rdi
callq 0x2230