try multithreading
This commit is contained in:
parent
b32b61fad8
commit
9e4af98d6c
@ -55,6 +55,7 @@ void StrategicPlayer::EventAddBox(char box, const Loc &loc) {
|
|||||||
|
|
||||||
void selectLine(Board &board, int &row, int &col, int rows, int cols, char name) {
|
void selectLine(Board &board, int &row, int &col, int rows, int cols, char name) {
|
||||||
// Step 1: Try to complete a box
|
// Step 1: Try to complete a box
|
||||||
|
#pragma omp parallel for collapse(2)
|
||||||
for (int r = 1; r < 2 * rows - 2; r += 2) {
|
for (int r = 1; r < 2 * rows - 2; r += 2) {
|
||||||
// Iterate over box centers (odd rows)
|
// Iterate over box centers (odd rows)
|
||||||
for (int c = 1; c < 2 * cols - 2; c += 2) {
|
for (int c = 1; c < 2 * cols - 2; c += 2) {
|
||||||
@ -100,6 +101,7 @@ void selectLine(Board &board, int &row, int &col, int rows, int cols, char name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Step 2: Avoid moves that leave a box with one line remaining
|
// Step 2: Avoid moves that leave a box with one line remaining
|
||||||
|
#pragma omp parallel for
|
||||||
for (int r = 0; r < 2 * rows - 1; ++r) {
|
for (int r = 0; r < 2 * rows - 1; ++r) {
|
||||||
// Iterate over all valid rows
|
// Iterate over all valid rows
|
||||||
for (int c = 0; c < 2 * cols - 1; ++c) {
|
for (int c = 0; c < 2 * cols - 1; ++c) {
|
||||||
|
Loading…
Reference in New Issue
Block a user