// File: /workspace/github_cpp_makefile_star2_O1/m-wiesner[P]Jotto/Jotto.cpp
// Function: main
int main(int argc, char** argv)
{
    string path_to_dict = "./text_files/wordlist.txt";
    char read_rules;
    char play_to_end;
    int level;
    cout << "========================================";
    cout << "========================================" << endl;
    cout << "                                !!  JOTTO  !!";
    cout << "                                " << endl;
    cout << "========================================";
    cout << "========================================" << endl;

    cout << "Do you want to read the rules? (y)/(n)";
    do
    {   if (!(cin >> read_rules))
        {
            exit (0);
        }
    } while ((read_rules != 'y' && read_rules != 'n') && (cout << "Enter (y) or (n)."));
    
    if (read_rules == 'y')
    {
        print_intro();      
    }



    cout << endl << endl << endl;
    cout << "========================================";
    cout << "========================================" << endl;
    cout << "                                !! START GAME !!";
    cout << "                                " << endl;
    

    print_level();
    do
    {
        if(!(cin >> level))
        {
            exit(0);
        }
        cout << "LEVEL: " << level << endl;
    } while (((level != 1) && (level != 2) && (level !=3)) && (cout << "Enter a level (1-3)"));
    


    // Default names
    string name1 = "AI1";
    string name2 = "AI2";

    srand((int)time(0));
    Guesser *g1;
    Guesser *g2;
  
    g1 = new ManualGuesser(name1, path_to_dict); 
    //switch (level)
    //{
    //    case 0: cout << "Enter your name: ";
    //            cin >> name1;
    //            g1 = new ManualGuesser(name1, path_to_dict);
    //            break;
    //    case 1: g1 = new Guesser(name1, path_to_dict); break;
    //    case 2: g1 = new RandomGuesser(name1, path_to_dict); break;
    //    case 3: g1 = new MaxinfoGuesser(name1, path_to_dict); break;
    //}

    switch (level)
    {
        case 0: cout << "Enter your name: ";
                cin >> name1;
                g2 = new ManualGuesser(name1, path_to_dict);
                break;
        case 1: g2 = new Guesser(name2, path_to_dict); break;
        case 2: g2 = new RandomGuesser(name2, path_to_dict); break;
        case 3: g2 = new MaxinfoGuesser(name2, path_to_dict); break;
    }

    ScoreKeeper sk(g1, g2);
  
    clear_screen(3); 
   
    int turnnumber = 1; 
    cout << " ========= Turn " << turnnumber << " ============== " << endl;
    while (sk.give_turn_to(g1) && sk.give_turn_to(g2))
    {
        clear_screen(3);
        cout << " ========= Turn " << turnnumber << " ============== " << endl;
        g1->update();
        g2->update();
        ++turnnumber;
    }

    cout << "Do you want to keep guessing? (y)/(n)";
    do
    {   if(!(cin >> play_to_end))
        {
            cout << "Codeword were ..." << endl;
            sk.print_codewords();
            exit(0);
        }
    } while ((play_to_end != 'y' && play_to_end != 'n') && (cout << "Enter (y) or (n)."));
    
    if (play_to_end == 'y')
    {
        while(sk.give_turn_to(g1))
        {
            clear_screen(3);
            cout << " ========= Turn " << turnnumber << " ============== " << endl;
            g1->update();
            ++turnnumber;
        }
    } 
    else
    {
        cout << "Codewords were ..." << endl;
        sk.print_codewords();
    } 
    delete g1;
    delete g2;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
leaq -0x50(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x3a05(%rip), %rsi      # 0x6014
leaq 0x3a17(%rip), %rdx      # 0x602d
leaq -0x60(%rbp), %rdi
callq 0x36a2
movq 0x69aa(%rip), %rdi      # 0x8fd0
leaq 0x3a01(%rip), %rsi      # 0x602e
movl $0x28, %edx
callq 0x2260
movq 0x6992(%rip), %rbx      # 0x8fd0
leaq 0x39e9(%rip), %rsi      # 0x602e
movl $0x28, %edx
movq %rbx, %rdi
callq 0x2260
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x6960(%rip), %rdi      # 0x8fd0
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x694c(%rip), %rdi      # 0x8fd0
leaq 0x39cc(%rip), %rsi      # 0x6057
movl $0x2d, %edx
callq 0x2260
movq 0x6934(%rip), %rbx      # 0x8fd0
leaq 0x39e2(%rip), %rsi      # 0x6085
movl $0x20, %edx
movq %rbx, %rdi
callq 0x2260
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x6902(%rip), %rdi      # 0x8fd0
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x68ee(%rip), %rdi      # 0x8fd0
leaq 0x3945(%rip), %rsi      # 0x602e
movl $0x28, %edx
callq 0x2260
movq 0x68d6(%rip), %rbx      # 0x8fd0
leaq 0x392d(%rip), %rsi      # 0x602e
movl $0x28, %edx
movq %rbx, %rdi
callq 0x2260
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x68a4(%rip), %rdi      # 0x8fd0
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x6890(%rip), %rbx      # 0x8fd0
leaq 0x395f(%rip), %rsi      # 0x60a6
movl $0x26, %edx
movq %rbx, %rdi
callq 0x2260
movq 0x6885(%rip), %r14      # 0x8fe0
leaq -0x2a(%rbp), %r15
leaq 0x3967(%rip), %r12      # 0x60cd
movq %r14, %rdi
movq %r15, %rsi
callq 0x22b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2ec7
movzbl -0x2a(%rbp), %eax
cmpl $0x6e, %eax
je 0x27af
cmpl $0x79, %eax
je 0x27af
movl $0x11, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2260
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
je 0x2766
cmpb $0x79, -0x2a(%rbp)
jne 0x27ba
callq 0x2f7e
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x67f8(%rip), %rdi      # 0x8fd0
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x6790(%rip), %rdi      # 0x8fd0
leaq 0x37e7(%rip), %rsi      # 0x602e
movl $0x28, %edx
callq 0x2260
movq 0x6778(%rip), %rbx      # 0x8fd0
leaq 0x37cf(%rip), %rsi      # 0x602e
movl $0x28, %edx
movq %rbx, %rdi
callq 0x2260
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x6746(%rip), %rdi      # 0x8fd0
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x6732(%rip), %rdi      # 0x8fd0
leaq 0x383a(%rip), %rsi      # 0x60df
movl $0x30, %edx
callq 0x2260
movq 0x671a(%rip), %rbx      # 0x8fd0
leaq 0x37c8(%rip), %rsi      # 0x6085
movl $0x20, %edx
movq %rbx, %rdi
callq 0x2260
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x66e8(%rip), %rbx      # 0x8fd0
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
callq 0x3240
leaq -0x3c(%rbp), %r15
leaq 0x3808(%rip), %r12      # 0x6110
leaq 0x3809(%rip), %r13      # 0x6118
movq 0x66ca(%rip), %rdi      # 0x8fe0
movq %r15, %rsi
callq 0x2110
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2ec7
movl $0x7, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2260
movl -0x3c(%rbp), %esi
movq %rbx, %rdi
callq 0x2310
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movl -0x3c(%rbp), %eax
addl $-0x4, %eax
cmpl $-0x4, %eax
ja 0x29a2
movl $0x13, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2260
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
je 0x290f
leaq -0x70(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x377b(%rip), %rsi      # 0x612c
leaq 0x3777(%rip), %rdx      # 0x612f
leaq -0x80(%rbp), %rdi
callq 0x36a2
leaq -0x98(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x375d(%rip), %rsi      # 0x6130
leaq 0x3759(%rip), %rdx      # 0x6133
leaq -0xa8(%rbp), %rdi
callq 0x36a2
xorl %edi, %edi
callq 0x21d0
movl %eax, %edi
callq 0x21e0
movl $0x58, %edi
callq 0x2210
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rbx
leaq -0x80(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movq %rbx, %rdi
callq 0x4a40
movl -0x3c(%rbp), %eax
cmpq $0x3, %rax
ja 0x2aea
leaq 0x35d4(%rip), %rcx      # 0x6004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x6590(%rip), %rdi      # 0x8fd0
leaq 0x36ed(%rip), %rsi      # 0x6134
movl $0x11, %edx
callq 0x2260
movq 0x6588(%rip), %rdi      # 0x8fe0
leaq -0x80(%rbp), %rsi
callq 0x22a0
movl $0x58, %edi
callq 0x2210
leaq -0x80(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movq %rax, -0x38(%rbp)
movq %rax, %rdi
callq 0x4a40
jmp 0x2aea
movl $0x58, %edi
callq 0x2210
leaq -0xa8(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movq %rax, -0x38(%rbp)
movq %rax, %rdi
callq 0x4c80
jmp 0x2aea
movl $0x58, %edi
callq 0x2210
leaq -0xa8(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movq %rax, -0x38(%rbp)
movq %rax, %rdi
callq 0x4f38
jmp 0x2aea
movl $0x58, %edi
callq 0x2210
leaq -0xa8(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movq %rax, -0x38(%rbp)
movq %rax, %rdi
callq 0x40d8
jmp 0x2aea
leaq -0xd8(%rbp), %rdi
movq %rbx, %rsi
movq -0x38(%rbp), %rdx
callq 0x51f4
movl $0x3, %edi
callq 0x342f
movq 0x64c2(%rip), %rdi      # 0x8fd0
leaq 0x3631(%rip), %rsi      # 0x6146
movl $0x10, %edx
callq 0x2260
movq 0x64aa(%rip), %rdi      # 0x8fd0
movl $0x1, %esi
callq 0x2310
movq %rax, %r14
leaq 0x361d(%rip), %rsi      # 0x6157
movl $0x10, %edx
movq %rax, %rdi
callq 0x2260
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movl $0x1, %r12d
leaq -0xd8(%rbp), %r13
movq 0x644e(%rip), %r14      # 0x8fd0
movq %r13, %rdi
movq %rbx, %rsi
callq 0x538e
testb %al, %al
je 0x2c2b
movq %r13, %rdi
movq -0x38(%rbp), %rsi
callq 0x538e
testb %al, %al
je 0x2c2b
movl $0x3, %edi
callq 0x342f
movl $0x10, %edx
movq %r14, %rdi
leaq 0x3584(%rip), %rsi      # 0x6146
callq 0x2260
movq %r14, %rdi
movl %r12d, %esi
callq 0x2310
movq %rax, %r15
movl $0x10, %edx
movq %rax, %rdi
leaq 0x3573(%rip), %rsi      # 0x6157
callq 0x2260
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq -0x38(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
incl %r12d
jmp 0x2b82
movq 0x639e(%rip), %r14      # 0x8fd0
leaq 0x352f(%rip), %rsi      # 0x6168
movl $0x25, %edx
movq %r14, %rdi
callq 0x2260
movq 0x6393(%rip), %r13      # 0x8fe0
leaq -0x29(%rbp), %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x22b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2e97
movzbl -0x29(%rbp), %eax
cmpl $0x6e, %eax
je 0x2c9f
cmpl $0x79, %eax
je 0x2c9f
movl $0x11, %edx
movq %r14, %rdi
leaq 0x3442(%rip), %rsi      # 0x60cd
callq 0x2260
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%r14,%rax)
je 0x2c51
cmpb $0x79, -0x29(%rbp)
jne 0x2d42
movq 0x6320(%rip), %r13      # 0x8fd0
leaq 0x34a0(%rip), %r14      # 0x6157
leaq -0xd8(%rbp), %rdi
movq %rbx, %rsi
callq 0x538e
testb %al, %al
je 0x2d94
movl $0x3, %edi
callq 0x342f
movl $0x10, %edx
movq %r13, %rdi
leaq 0x345f(%rip), %rsi      # 0x6146
callq 0x2260
movq %r13, %rdi
movl %r12d, %esi
callq 0x2310
movq %rax, %r15
movl $0x10, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2260
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
incl %r12d
jmp 0x2cb7
movq 0x6287(%rip), %r14      # 0x8fd0
leaq 0x3450(%rip), %rsi      # 0x61a0
movl $0x12, %edx
movq %r14, %rdi
callq 0x2260
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x6255(%rip), %rdi      # 0x8fd0
callq 0x2030
movq %rax, %rdi
callq 0x2150
leaq -0xd8(%rbp), %rdi
callq 0x5784
leaq 0x5f1d(%rip), %r14      # 0x8cb8
addq $0x10, %r14
movq %r14, (%rbx)
movq -0x88(%rbp), %r15
leaq 0x40(%r15), %rdi
callq 0x3594
leaq 0x28(%r15), %rdi
callq 0x352a
movq 0x8(%rbx), %rdi
addq $0x18, %r15
cmpq %r15, %rdi
je 0x2dd3
movq (%r15), %rsi
incq %rsi
callq 0x2220
movl $0x58, %esi
movq %rbx, %rdi
callq 0x2220
movq -0x38(%rbp), %rbx
testq %rbx, %rbx
je 0x2e23
movq %r14, (%rbx)
leaq 0x40(%rbx), %rdi
callq 0x3594
leaq 0x28(%rbx), %rdi
callq 0x352a
movq 0x8(%rbx), %rdi
leaq 0x18(%rbx), %rax
cmpq %rax, %rdi
je 0x2e16
movq (%rax), %rsi
incq %rsi
callq 0x2220
movl $0x58, %esi
movq %rbx, %rdi
callq 0x2220
leaq -0xd8(%rbp), %rdi
callq 0x35f2
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x2e51
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2220
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x2e6a
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2220
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x2e83
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x2220
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6132(%rip), %rdi      # 0x8fd0
leaq 0x32e9(%rip), %rsi      # 0x618e
movl $0x11, %edx
callq 0x2260
movq 0x611a(%rip), %rdi      # 0x8fd0
callq 0x20e0
leaq -0xd8(%rbp), %rdi
callq 0x5784
xorl %edi, %edi
callq 0x2280
jmp 0x2ed4
jmp 0x2ed4
jmp 0x2ed4
movq %rax, %r14
movl $0x58, %esi
movq -0x38(%rbp), %rdi
jmp 0x2ef1
jmp 0x2f13
jmp 0x2eff
movq %rax, %r14
movl $0x58, %esi
movq %rbx, %rdi
callq 0x2220
jmp 0x2f22
movq %rax, %r14
jmp 0x2f44
jmp 0x2f0c
movq %rax, %r14
jmp 0x2f22
jmp 0x2f13
jmp 0x2f13
jmp 0x2f0c
jmp 0x2f0c
movq %rax, %r14
jmp 0x2f5d
jmp 0x2f13
movq %rax, %r14
leaq -0xd8(%rbp), %rdi
callq 0x35f2
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x2f44
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2220
leaq -0x70(%rbp), %rax
movq -0x80(%rbp), %rdi
cmpq %rax, %rdi
je 0x2f5d
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2220
leaq -0x50(%rbp), %rax
movq -0x60(%rbp), %rdi
cmpq %rax, %rdi
je 0x2f76
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x2220
movq %r14, %rdi
callq 0x2320