// File: /workspace/github_cpp_makefile_star2_O1/Matlock42[P]Jeopardy/jgameClass.cpp
// Function: Game::showBoard()
int Game::showBoard(void)
{
	clearScreen();
	int i,j,k;
	int lPrompt;
	int * t; // Number of additional tabs to add to make things line up
	t = new int [mSize];

	for(j = 0; j < mSize; j++)	// print category names
	{
		cout << mQuestionSet[j][0]->category() << "\t";
		t[j] = ((mQuestionSet[j][0]->category().length()) / 8); // each tab takes 8 char spaces in the terminal
	}
	cout << "\n";

	for(i = 0; i < mSize; i++)	// different rows (prices)
	{
		for(j=0; j < mSize; j++) // go through each category
		{
			std::string tabs = "\t"; // tabs between each
			for(k=0; k < t[j]; k++)
			{
				tabs.append("\t");  // Add any additional tabs
			}

			// display empty slot if the question has already been played
			if(mQuestionSet[j][i]->hasBeenPlayed())
			{
				cout << "----" << tabs;
			}
			else	// display the amount the question is worth
			{
				cout << "$" << mQuestionSet[j][i]->price() << tabs;
			}
		}
		cout << "\n\n";
	}
	// Display the current score and prompt for the next question
	cout << "\t\tScore: " << mScore << "\n";
	
	// validate the input
	bool lInputError = false;
	do
	{
		cout << "Next question: \n";
	    if (cin >> lPrompt) // Sanitize input to an integer
	    {
	    	lInputError = false;
	    } 
	    else
	    {
	        cout << "Entered value is not an Integer.\n";
	        cin.clear();
	        cin.ignore(numeric_limits<streamsize>::max(), '\n');
	        lInputError = true;
	    }
		if( lPrompt == 9000 )
		{
			cout << "I'm sorry, Dave. I'm afraid I can't do that.\n"; // 2001
			lInputError = true;
		}
		else if( lPrompt > (mSize * 11)) // only allow up to the max question number
		{
			cout << "We need to go to the crappy town where I'm a hero!\n"; // Firefly
			lInputError = true;
		}
		else if( lPrompt > 9000 )
		{
			cout << "It's over 9000!\n"; 
			lInputError = true;
		}

	} while (lInputError);
	clearScreen();
	showQuestion(lPrompt);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, -0x30(%rbp)
movl $0x1, %ebx
movq 0x5fc7(%rip), %r14      # 0x8fc0
leaq 0x31b6(%rip), %r15      # 0x61b6
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2230
decl %ebx
je 0x3000
movq -0x30(%rbp), %r12
movslq 0x8(%r12), %rbx
leaq (,%rbx,4), %rax
testq %rbx, %rbx
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x2030
movq %rax, -0x60(%rbp)
testq %rbx, %rbx
jle 0x30fc
xorl %r14d, %r14d
leaq -0x50(%rbp), %r15
movq 0x5f6d(%rip), %rbx      # 0x8fc0
leaq 0x3016(%rip), %r13      # 0x6070
movq 0x10(%r12), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rsi
movq %r15, %rdi
callq 0x5ee8
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %rbx, %rdi
callq 0x2230
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x2230
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x30a7
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rsi
movq %r15, %rdi
callq 0x5ee8
movq -0x48(%rbp), %rax
shrq $0x3, %rax
movq -0x60(%rbp), %rcx
movl %eax, (%rcx,%r14,4)
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x30e7
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
incq %r14
movq -0x30(%rbp), %r12
movslq 0x8(%r12), %rax
cmpq %rax, %r14
jl 0x305a
movq 0x5ebd(%rip), %rdi      # 0x8fc0
leaq 0x30ac(%rip), %rsi      # 0x61b6
movl $0x1, %edx
callq 0x2230
cmpl $0x0, 0x8(%r12)
movq %r12, %rbx
jle 0x3250
xorl %r14d, %r14d
leaq 0x2f43(%rip), %r12      # 0x6070
leaq -0x50(%rbp), %r13
cmpl $0x0, 0x8(%rbx)
jle 0x3224
xorl %r15d, %r15d
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq %r13, %rdi
movq %r12, %rsi
leaq 0x2f1e(%rip), %rdx      # 0x6071
callq 0x44cc
movq -0x60(%rbp), %rax
movl (%rax,%r15,4), %ebx
testl %ebx, %ebx
jle 0x3173
movq %r13, %rdi
movq %r12, %rsi
callq 0x23c0
decl %ebx
jne 0x3164
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r15,8), %rax
movq (%rax,%r14,8), %rdi
callq 0x5ec4
testb %al, %al
je 0x31a9
movl $0x4, %edx
movq 0x5e28(%rip), %rbx      # 0x8fc0
movq %rbx, %rdi
leaq 0x2ed0(%rip), %rsi      # 0x6072
callq 0x2230
jmp 0x31e7
movl $0x1, %edx
movq 0x5e0b(%rip), %rdi      # 0x8fc0
leaq 0x2ebb(%rip), %rsi      # 0x6077
callq 0x2230
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r15,8), %rax
movq (%rax,%r14,8), %rdi
callq 0x5f14
movq 0x5de3(%rip), %rdi      # 0x8fc0
movl %eax, %esi
callq 0x2340
movq %rax, %rbx
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %rbx, %rdi
callq 0x2230
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x3210
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
incq %r15
movq -0x30(%rbp), %rax
movslq 0x8(%rax), %rax
cmpq %rax, %r15
jl 0x313e
movl $0x2, %edx
movq 0x5d90(%rip), %rdi      # 0x8fc0
leaq 0x2f7e(%rip), %rsi      # 0x61b5
callq 0x2230
incq %r14
movq -0x30(%rbp), %rbx
movslq 0x8(%rbx), %rax
cmpq %rax, %r14
jl 0x3131
movq 0x5d69(%rip), %r14      # 0x8fc0
leaq 0x2e1b(%rip), %rsi      # 0x6079
movl $0x9, %edx
movq %r14, %rdi
callq 0x2230
movl 0x4(%rbx), %esi
movq %r14, %rdi
callq 0x2340
leaq 0x2f39(%rip), %rsi      # 0x61b6
movl $0x1, %edx
movq %rax, %rdi
callq 0x2230
leaq 0x2df2(%rip), %rbx      # 0x6083
movq 0x5d38(%rip), %r12      # 0x8fd0
leaq -0x54(%rbp), %r13
movl $0x10, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2230
movq %r12, %rdi
movq %r13, %rsi
callq 0x2110
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x20(%rax,%rcx), %r15d
testb $0x5, %r15b
je 0x3306
movl $0x21, %edx
movq %r14, %rdi
leaq 0x2dbc(%rip), %rsi      # 0x6094
callq 0x2230
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
xorl %esi, %esi
callq 0x2320
movq %r12, %rdi
movabsq $0x7fffffffffffffff, %rsi # imm = 0x7FFFFFFFFFFFFFFF
movl $0xa, %edx
callq 0x2120
movl -0x54(%rbp), %eax
cmpl $0x2328, %eax           # imm = 0x2328
jne 0x3329
movl $0x2d, %edx
movq %r14, %rdi
leaq 0x2d97(%rip), %rsi      # 0x60b6
callq 0x2230
jmp 0x329c
movq -0x30(%rbp), %rcx
movl 0x8(%rcx), %ecx
leal (%rcx,%rcx,4), %edx
leal (%rcx,%rdx,2), %ecx
cmpl %ecx, %eax
jle 0x3353
movl $0x33, %edx
movq %r14, %rdi
leaq 0x2d9b(%rip), %rsi      # 0x60e4
callq 0x2230
jmp 0x329c
cmpl $0x2329, %eax           # imm = 0x2329
jl 0x3373
movl $0x10, %edx
movq %r14, %rdi
leaq 0x2daf(%rip), %rsi      # 0x6118
callq 0x2230
jmp 0x329c
testb $0x5, %r15b
jne 0x329c
movl $0x1, %ebx
movq 0x5c37(%rip), %r14      # 0x8fc0
leaq 0x2e26(%rip), %r15      # 0x61b6
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2230
decl %ebx
je 0x3390
movl -0x54(%rbp), %esi
movq -0x30(%rbp), %rdi
callq 0x33ee
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x33ca
movq %rax, %rbx
jmp 0x33e6
jmp 0x33ca
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x33e6
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2370