// File: kaiming[P]Chamber-Crawler-3k/TextDisplay/textdisplay.cc
// Function: TextDisplay::drawFloor(std::ostream&, Board&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void TextDisplay::drawFloor(std::ostream& out, Board& board, std::string action) {
    // Print out floor diagram

    // Iterate through the current floor
    for(auto it_i = board.floors[board.getFloorNum() - 1].begin(); it_i != board.floors[board.getFloorNum() - 1].end(); ++ it_i) {
        for (auto it_j = it_i->begin(); it_j != it_i->end(); ++ it_j) {
            
            // Determine if Walkable Tile
            if (std::dynamic_pointer_cast<WalkableTile>(*it_j)) {
                // Walkable Tile 
                // Determine symbol to print
                
                // Check for Exit, Gold, Potion, or Character
                
                if (std::static_pointer_cast<WalkableTile>(*it_j)->getOccupant() != nullptr) {
                    // Determine Player or Enemy
                    
                    // Check if player
                    if ((*it_j) == board.player) {
                        // Print "@" for player
                        out << "@";
                        continue;
                    }

                    // Determine enemy type 
                    std::string enemy = std::static_pointer_cast<WalkableTile>(*it_j)->getOccupant()->getRace();

                    if (enemy == "Human") {
                        // Print "H" for Human
                        out << "H";
                    } else if (enemy == "Dwarf") {
                        // Print "W" for Dwarf
                        out << "W";
                    } else if (enemy == "Elf") {
                        // Print "E" for Elf
                        out << "E";
                    } else if (enemy == "Orc") {
                        // Print "O" for Orc
                        out << "O";
                    } else if (enemy == "Merchant") {
                        // Print "M" for Merchant
                        out << "M";
                    } else if (enemy == "Dragon") {
                        // Print "D" for Dragon
                        out << "D";
                    } else if (enemy == "Halfling") {
                        // Print "L" for Halfling
                        out << "L";
                    }

                } else if (std::static_pointer_cast<WalkableTile>(*it_j)->isExit()) {
                    // Print "\" for stairs
                    out << "\\";
                } else if (std::static_pointer_cast<WalkableTile>(*it_j)->getPotion() != nullptr) {
                    // Print "P" for potion
                    out << "P";
                } else if (std::static_pointer_cast<WalkableTile>(*it_j)->getGold() != nullptr) {
                    // Print "G" for gold
                    out << "G";
                } else {
                    // Not occupied, print type
                    out << (std::static_pointer_cast<WalkableTile>(*it_j)->getType());
                }

            } else {
                // Regular Tile, print type
                out << (*it_j)->getType();
            }

        } // End of inner loop

        // Print new line
        out << std::endl;

    } // End of outer loop


    // Print status

    // Print Status format
    // Race: XXXXX  Gold: XXX             Floor: XX
    // HP: XXX
    // Atk: XXX
    // Def: XXX
    // Action:

    // Race: XXXXX  Gold: XXX             Floor: XX
    // 24 chars Race + Gold & 9 Chars for Floor: XX
    out << "Race: " << std::left << std::setw(7) << board.playerPtr->getRace() << "  Gold: " << std::setw(3) << board.playerPtr->getGold() << std::right << std::setw(board.floors[board.floorNum -1][1].size() - 33) << "Floor: " << std::setw(2) << board.floorNum << std::endl; 
    // HP: XXX
    out << "HP: " << board.playerPtr->getHP() << std::endl;
    // Atk: XXX
    out << "Atk: " << board.playerPtr->getAtk() << std::endl;
    // Def: XXX
    out << "Def: " << board.playerPtr->getDef() << std::endl;
    // Action:
    out << "Action: " << action << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x270, %rsp            # imm = 0x270
movq %rcx, -0x168(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x18(%rbp), %rdi
callq 0x25090
movq -0x160(%rbp), %rdi
subl $0x1, %eax
movslq %eax, %rsi
callq 0x11e20
movq %rax, %rdi
callq 0x170c0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x18(%rbp), %rdi
callq 0x25090
movq -0x170(%rbp), %rdi
subl $0x1, %eax
movslq %eax, %rsi
callq 0x11e20
movq %rax, %rdi
callq 0x16f30
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2e190
testb $0x1, %al
jne 0x3b2cc
jmp 0x3b957
leaq -0x28(%rbp), %rdi
callq 0x2e1d0
movq %rax, %rdi
callq 0x17940
movq %rax, -0x38(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x2e1d0
movq %rax, %rdi
callq 0x177c0
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2e1f0
testb $0x1, %al
jne 0x3b30c
jmp 0x3b939
leaq -0x38(%rbp), %rdi
callq 0x2e230
movq %rax, %rsi
leaq -0x50(%rbp), %rdi
callq 0x2e100
leaq -0x50(%rbp), %rdi
callq 0x1ed00
movb %al, -0x171(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x99e0
movb -0x171(%rbp), %al
testb $0x1, %al
jne 0x3b348
jmp 0x3b8f6
leaq -0x38(%rbp), %rdi
callq 0x2e230
movq %rax, %rsi
leaq -0x70(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x128c0
movq -0x180(%rbp), %rdi
callq 0x2e040
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x3bf60
jmp 0x3b37e
leaq -0x60(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2e4a0
movb %al, -0x181(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x11fa0
leaq -0x70(%rbp), %rdi
callq 0x99e0
movb -0x181(%rbp), %al
testb $0x1, %al
jne 0x3b3b2
jmp 0x3b691
leaq -0x38(%rbp), %rdi
callq 0x2e230
movq %rax, %rdi
movq -0x18(%rbp), %rsi
addq $0xb8, %rsi
callq 0x3bcd0
testb $0x1, %al
jne 0x3b3d4
jmp 0x3b403
movq -0x10(%rbp), %rdi
leaq 0x2e9f(%rip), %rsi      # 0x3e27e
callq 0x62e0
jmp 0x3b92b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x99e0
jmp 0x3bcbb
leaq -0x38(%rbp), %rdi
callq 0x2e230
movq %rax, %rsi
leaq -0xc0(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0x128c0
movq -0x190(%rbp), %rdi
callq 0x2e040
movq %rax, %rsi
leaq -0xb0(%rbp), %rdi
callq 0x3bf60
jmp 0x3b43f
leaq -0xb0(%rbp), %rdi
callq 0x2e3e0
movq %rax, %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0xa0(%rbp), %rdi
callq *%rax
jmp 0x3b45f
leaq -0xb0(%rbp), %rdi
callq 0x11fa0
leaq -0xc0(%rbp), %rdi
callq 0x99e0
leaq 0x2922(%rip), %rsi      # 0x3dda0
leaq -0xa0(%rbp), %rdi
callq 0x8ae0
movb %al, -0x191(%rbp)
jmp 0x3b492
movb -0x191(%rbp), %al
testb $0x1, %al
jne 0x3b49e
jmp 0x3b509
movq -0x10(%rbp), %rdi
leaq 0x2db0(%rip), %rsi      # 0x3e259
callq 0x62e0
jmp 0x3b4b0
jmp 0x3b680
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x3b4db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x11fa0
leaq -0xc0(%rbp), %rdi
callq 0x99e0
jmp 0x3bcbb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x61c0
jmp 0x3bcbb
leaq 0x2b48(%rip), %rsi      # 0x3e058
leaq -0xa0(%rbp), %rdi
callq 0x8ae0
movb %al, -0x192(%rbp)
jmp 0x3b524
movb -0x192(%rbp), %al
testb $0x1, %al
jne 0x3b530
jmp 0x3b547
movq -0x10(%rbp), %rdi
leaq 0x2d45(%rip), %rsi      # 0x3e280
callq 0x62e0
jmp 0x3b542
jmp 0x3b67e
leaq 0x2b2a(%rip), %rsi      # 0x3e078
leaq -0xa0(%rbp), %rdi
callq 0x8ae0
movb %al, -0x193(%rbp)
jmp 0x3b562
movb -0x193(%rbp), %al
testb $0x1, %al
jne 0x3b56e
jmp 0x3b585
movq -0x10(%rbp), %rdi
leaq 0x2d09(%rip), %rsi      # 0x3e282
callq 0x62e0
jmp 0x3b580
jmp 0x3b67c
leaq 0x2b5c(%rip), %rsi      # 0x3e0e8
leaq -0xa0(%rbp), %rdi
callq 0x8ae0
movb %al, -0x194(%rbp)
jmp 0x3b5a0
movb -0x194(%rbp), %al
testb $0x1, %al
jne 0x3b5ac
jmp 0x3b5c3
movq -0x10(%rbp), %rdi
leaq 0x2ccd(%rip), %rsi      # 0x3e284
callq 0x62e0
jmp 0x3b5be
jmp 0x3b67a
leaq 0x27f5(%rip), %rsi      # 0x3ddbf
leaq -0xa0(%rbp), %rdi
callq 0x8ae0
movb %al, -0x195(%rbp)
jmp 0x3b5de
movb -0x195(%rbp), %al
testb $0x1, %al
jne 0x3b5ea
jmp 0x3b5fe
movq -0x10(%rbp), %rdi
leaq 0x2c91(%rip), %rsi      # 0x3e286
callq 0x62e0
jmp 0x3b5fc
jmp 0x3b678
leaq 0x2784(%rip), %rsi      # 0x3dd89
leaq -0xa0(%rbp), %rdi
callq 0x8ae0
movb %al, -0x196(%rbp)
jmp 0x3b619
movb -0x196(%rbp), %al
testb $0x1, %al
jne 0x3b625
jmp 0x3b639
movq -0x10(%rbp), %rdi
leaq 0x2c19(%rip), %rsi      # 0x3e249
callq 0x62e0
jmp 0x3b637
jmp 0x3b676
leaq 0x2a50(%rip), %rsi      # 0x3e090
leaq -0xa0(%rbp), %rdi
callq 0x8ae0
movb %al, -0x197(%rbp)
jmp 0x3b654
movb -0x197(%rbp), %al
testb $0x1, %al
jne 0x3b660
jmp 0x3b674
movq -0x10(%rbp), %rdi
leaq 0x2c1d(%rip), %rsi      # 0x3e288
callq 0x62e0
jmp 0x3b672
jmp 0x3b674
jmp 0x3b676
jmp 0x3b678
jmp 0x3b67a
jmp 0x3b67c
jmp 0x3b67e
jmp 0x3b680
leaq -0xa0(%rbp), %rdi
callq 0x61c0
jmp 0x3b8f4
leaq -0x38(%rbp), %rdi
callq 0x2e230
movq %rax, %rsi
leaq -0xd0(%rbp), %rdi
movq %rdi, -0x1a0(%rbp)
callq 0x128c0
movq -0x1a0(%rbp), %rdi
callq 0x2e040
movq %rax, %rdi
callq 0x3c080
movb %al, -0x198(%rbp)
jmp 0x3b6cc
leaq -0xd0(%rbp), %rdi
callq 0x99e0
movb -0x198(%rbp), %al
testb $0x1, %al
jne 0x3b6e4
jmp 0x3b716
movq -0x10(%rbp), %rdi
leaq 0x2b9b(%rip), %rsi      # 0x3e28a
callq 0x62e0
jmp 0x3b8f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x99e0
jmp 0x3bcbb
leaq -0x38(%rbp), %rdi
callq 0x2e230
movq %rax, %rsi
leaq -0xf0(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x128c0
movq -0x1a8(%rbp), %rdi
callq 0x2e040
movq %rax, %rsi
leaq -0xe0(%rbp), %rdi
callq 0x3bfc0
jmp 0x3b752
leaq -0xe0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2e4d0
movb %al, -0x1a9(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x11f80
leaq -0xf0(%rbp), %rdi
callq 0x99e0
movb -0x1a9(%rbp), %al
testb $0x1, %al
jne 0x3b78c
jmp 0x3b7be
movq -0x10(%rbp), %rdi
leaq 0x2af5(%rip), %rsi      # 0x3e28c
callq 0x62e0
jmp 0x3b8f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x99e0
jmp 0x3bcbb
leaq -0x38(%rbp), %rdi
callq 0x2e230
movq %rax, %rsi
leaq -0x110(%rbp), %rdi
movq %rdi, -0x1b8(%rbp)
callq 0x128c0
movq -0x1b8(%rbp), %rdi
callq 0x2e040
movq %rax, %rsi
leaq -0x100(%rbp), %rdi
callq 0x3c020
jmp 0x3b7fa
leaq -0x100(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2e500
movb %al, -0x1b9(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x11f60
leaq -0x110(%rbp), %rdi
callq 0x99e0
movb -0x1b9(%rbp), %al
testb $0x1, %al
jne 0x3b834
jmp 0x3b866
movq -0x10(%rbp), %rdi
leaq 0x2a4f(%rip), %rsi      # 0x3e28e
callq 0x62e0
jmp 0x3b8ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x99e0
jmp 0x3bcbb
movq -0x10(%rbp), %rax
movq %rax, -0x1d0(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x2e230
movq %rax, %rsi
leaq -0x120(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
callq 0x128c0
movq -0x1c8(%rbp), %rdi
callq 0x2e040
movq %rax, %rdi
callq 0x3be20
movb %al, -0x1ba(%rbp)
jmp 0x3b8ac
movq -0x1d0(%rbp), %rdi
movb -0x1ba(%rbp), %al
movsbl %al, %esi
callq 0x63b0
jmp 0x3b8c3
leaq -0x120(%rbp), %rdi
callq 0x99e0
jmp 0x3b8ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x99e0
jmp 0x3bcbb
jmp 0x3b8f0
jmp 0x3b8f2
jmp 0x3b8f4
jmp 0x3b929
movq -0x10(%rbp), %rax
movq %rax, -0x1d8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x2e230
movq %rax, %rdi
callq 0x2e250
movq %rax, %rdi
callq 0x3be20
movq -0x1d8(%rbp), %rdi
movsbl %al, %esi
callq 0x63b0
jmp 0x3b92b
leaq -0x38(%rbp), %rdi
callq 0x2e2f0
jmp 0x3b2e1
movq -0x10(%rbp), %rdi
movq 0x1e66c(%rip), %rsi     # 0x59fb0
callq 0x6320
leaq -0x28(%rbp), %rdi
callq 0x2e310
jmp 0x3b284
movq -0x10(%rbp), %rdi
leaq 0x292e(%rip), %rsi      # 0x3e290
callq 0x62e0
movq %rax, %rdi
leaq 0x39f(%rip), %rsi       # 0x3bd10
callq 0x60f0
movq %rax, -0x1f8(%rbp)
movl $0x7, %edi
callq 0x3bd40
movq -0x1f8(%rbp), %rdi
movl %eax, -0x124(%rbp)
movl -0x124(%rbp), %esi
callq 0x6390
movq %rax, -0x1f0(%rbp)
movq -0x18(%rbp), %rdi
addq $0xf8, %rdi
callq 0x2e020
movq %rax, %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x148(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
callq *%rax
movq -0x1f0(%rbp), %rdi
movq -0x1e8(%rbp), %rsi
callq 0x62a0
movq %rax, -0x1e0(%rbp)
jmp 0x3b9eb
movq -0x1e0(%rbp), %rdi
leaq 0x289e(%rip), %rsi      # 0x3e297
callq 0x62e0
movq %rax, -0x200(%rbp)
jmp 0x3ba07
movl $0x3, %edi
callq 0x3bd40
movl %eax, -0x204(%rbp)
jmp 0x3ba19
movq -0x200(%rbp), %rdi
movl -0x204(%rbp), %eax
movl %eax, -0x14c(%rbp)
movl -0x14c(%rbp), %esi
callq 0x6390
movq %rax, -0x210(%rbp)
jmp 0x3ba40
movq -0x18(%rbp), %rdi
addq $0xf8, %rdi
callq 0x2e020
movq %rax, %rdi
callq 0x396b0
movl %eax, -0x214(%rbp)
jmp 0x3ba60
movl -0x214(%rbp), %esi
movq -0x210(%rbp), %rdi
callq 0x6520
movq %rax, -0x220(%rbp)
jmp 0x3ba7b
movq -0x220(%rbp), %rdi
leaq 0x2d7(%rip), %rsi       # 0x3bd60
callq 0x60f0
movq %rax, -0x228(%rbp)
jmp 0x3ba97
movq -0x18(%rbp), %rdi
movl 0x108(%rdi), %eax
decl %eax
movslq %eax, %rsi
callq 0x11e20
movq %rax, %rdi
movl $0x1, %esi
callq 0x11fc0
movq %rax, %rdi
callq 0xb9d0
movl %eax, %edi
addl $-0x21, %edi
callq 0x3bd40
movl %eax, -0x22c(%rbp)
jmp 0x3bad2
movq -0x228(%rbp), %rdi
movl -0x22c(%rbp), %eax
movl %eax, -0x150(%rbp)
movl -0x150(%rbp), %esi
callq 0x6390
movq %rax, -0x238(%rbp)
jmp 0x3baf9
movq -0x238(%rbp), %rdi
leaq 0x2799(%rip), %rsi      # 0x3e2a0
callq 0x62e0
movq %rax, -0x240(%rbp)
jmp 0x3bb15
movl $0x2, %edi
callq 0x3bd40
movl %eax, -0x244(%rbp)
jmp 0x3bb27
movq -0x240(%rbp), %rdi
movl -0x244(%rbp), %eax
movl %eax, -0x154(%rbp)
movl -0x154(%rbp), %esi
callq 0x6390
movq %rax, -0x250(%rbp)
jmp 0x3bb4e
movq -0x250(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x108(%rax), %esi
callq 0x6520
movq %rax, -0x258(%rbp)
jmp 0x3bb6d
movq -0x258(%rbp), %rdi
movq 0x1e435(%rip), %rsi     # 0x59fb0
callq 0x6320
jmp 0x3bb82
leaq -0x148(%rbp), %rdi
callq 0x61c0
movq -0x10(%rbp), %rdi
leaq 0x270f(%rip), %rsi      # 0x3e2a8
callq 0x62e0
movq %rax, -0x270(%rbp)
movq -0x18(%rbp), %rdi
addq $0xf8, %rdi
callq 0x2e020
movq %rax, %rdi
callq 0x34760
movq -0x270(%rbp), %rdi
callq 0x6590
movq %rax, %rdi
movq 0x1e3dd(%rip), %rsi     # 0x59fb0
callq 0x6320
movq -0x10(%rbp), %rdi
leaq 0x26ca(%rip), %rsi      # 0x3e2ad
callq 0x62e0
movq %rax, -0x268(%rbp)
movq -0x18(%rbp), %rdi
addq $0xf8, %rdi
callq 0x2e020
movq %rax, %rdi
callq 0x34780
movq -0x268(%rbp), %rdi
callq 0x6590
movq %rax, %rdi
movq 0x1e393(%rip), %rsi     # 0x59fb0
callq 0x6320
movq -0x10(%rbp), %rdi
leaq 0x2686(%rip), %rsi      # 0x3e2b3
callq 0x62e0
movq %rax, -0x260(%rbp)
movq -0x18(%rbp), %rdi
addq $0xf8, %rdi
callq 0x2e020
movq %rax, %rdi
callq 0x347a0
movq -0x260(%rbp), %rdi
callq 0x6590
movq %rax, %rdi
movq 0x1e349(%rip), %rsi     # 0x59fb0
callq 0x6320
movq -0x10(%rbp), %rdi
leaq 0x2642(%rip), %rsi      # 0x3e2b9
callq 0x62e0
movq -0x168(%rbp), %rsi
movq %rax, %rdi
callq 0x62a0
movq %rax, %rdi
movq 0x1e31b(%rip), %rsi     # 0x59fb0
callq 0x6320
addq $0x270, %rsp            # imm = 0x270
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x61c0
movq -0x78(%rbp), %rdi
callq 0x6540
nopw %cs:(%rax,%rax)
nop