// File: monjar[P]N-Queens-Problem/game.cpp
// Function: Game::initializeRandomly()
void Game::initializeRandomly() {
	
	if ( board->getQueensCount() > board->getRowsCount() * board->getColumnsCount() )
		throw "Number of queens is more that number of cells! Exiting.";

	std::vector<Cor> allCells;
	for ( int i = 0; i < board->getRowsCount(); i++ ) 
		for ( int j = 0; j < board->getColumnsCount(); j++ ){
			Cor temp( i, j );
			allCells.push_back( temp );
		}

	std::shuffle( allCells.begin(), allCells.end(), std::default_random_engine( time( NULL ) ) );
	
	for ( int i = 0; i < board->getQueensCount(); i++ )
		(*board)[allCells[i].getY()][allCells[i].getX()]->setValue( NQueenBoard::QUEEN_CELL );

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq (%rax), %rdi
callq 0x3a10
movq %rax, %rcx
movq -0x78(%rbp), %rax
movl (%rcx), %ecx
movq %rcx, -0x68(%rbp)
movq (%rax), %rdi
callq 0x44c0
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x70(%rbp)
movq (%rax), %rdi
callq 0x44e0
movq -0x70(%rbp), %rcx
movq %rax, %rdx
movq -0x68(%rbp), %rax
imulq %rdx, %rcx
cmpq %rcx, %rax
jbe 0x1962
movl $0x8, %edi
callq 0x1070
movq %rax, %rdi
leaq 0x572f(%rip), %rax      # 0x707e
movq %rax, (%rdi)
movq 0xa677(%rip), %rsi      # 0xbfd0
xorl %eax, %eax
movl %eax, %edx
callq 0x1150
leaq -0x20(%rbp), %rdi
callq 0x1c10
movl $0x0, -0x24(%rbp)
movq -0x78(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq %rcx, -0x88(%rbp)
movq (%rax), %rdi
callq 0x44c0
movq %rax, -0x80(%rbp)
jmp 0x198f
movq -0x88(%rbp), %rax
movq -0x80(%rbp), %rcx
cmpq %rcx, %rax
jae 0x1a36
movl $0x0, -0x38(%rbp)
movq -0x78(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq %rcx, -0x98(%rbp)
movq (%rax), %rdi
callq 0x44e0
movq %rax, -0x90(%rbp)
jmp 0x19ca
movq -0x98(%rbp), %rax
movq -0x90(%rbp), %rcx
cmpq %rcx, %rax
jae 0x1a26
leaq -0x40(%rbp), %rdi
leaq -0x24(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x5e30
jmp 0x19f0
leaq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x1c30
jmp 0x19ff
jmp 0x1a01
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x19aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x1fc0
jmp 0x1b6d
jmp 0x1a28
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1972
leaq -0x20(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x1f10
movq -0xa0(%rbp), %rdi
movq %rax, -0x48(%rbp)
callq 0x1f40
movq %rax, -0x50(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x10c0
movq %rax, %rsi
leaq -0x58(%rbp), %rdi
callq 0x1f70
jmp 0x1a71
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x1ca0
jmp 0x1a84
movl $0x0, -0x5c(%rbp)
movq -0x78(%rbp), %rax
movl -0x5c(%rbp), %ecx
movl %ecx, -0xac(%rbp)
movq (%rax), %rdi
callq 0x3a10
movq %rax, -0xa8(%rbp)
jmp 0x1aa9
movl -0xac(%rbp), %eax
movq -0xa8(%rbp), %rcx
cmpl (%rcx), %eax
jae 0x1b5b
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xc0(%rbp)
movslq -0x5c(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0x1fa0
movq %rax, %rdi
callq 0x5f30
movq %rax, -0xb8(%rbp)
jmp 0x1aea
movq -0xb8(%rbp), %rsi
movq -0xc0(%rbp), %rdi
callq 0x4570
movq %rax, -0xc8(%rbp)
jmp 0x1b06
movslq -0x5c(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0x1fa0
movq %rax, %rdi
callq 0x5f20
movq %rax, -0xd0(%rbp)
jmp 0x1b24
movq -0xc8(%rbp), %rdi
movq -0xd0(%rbp), %rax
movslq (%rax), %rsi
callq 0x1bf0
movq (%rax), %rdi
leaq 0x5590(%rip), %rsi      # 0x70d4
callq 0x5e10
jmp 0x1b4b
jmp 0x1b4d
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x1a8b
leaq -0x20(%rbp), %rdi
callq 0x1fc0
addq $0xd0, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x1160
nopw %cs:(%rax,%rax)