try multithreading

This commit is contained in:
Sandipsinh Rathod 2024-12-06 17:38:15 -05:00
parent b32b61fad8
commit 9e4af98d6c
No known key found for this signature in database

@ -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) {
// Step 1: Try to complete a box
#pragma omp parallel for collapse(2)
for (int r = 1; r < 2 * rows - 2; r += 2) {
// Iterate over box centers (odd rows)
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
#pragma omp parallel for
for (int r = 0; r < 2 * rows - 1; ++r) {
// Iterate over all valid rows
for (int c = 0; c < 2 * cols - 1; ++c) {