diff --git a/Assets/Script/Renju/KSH_Renju/DoubleFourCheck.cs b/Assets/Script/Renju/KSH_Renju/DoubleFourCheck.cs index c4e23b5..499c28d 100644 --- a/Assets/Script/Renju/KSH_Renju/DoubleFourCheck.cs +++ b/Assets/Script/Renju/KSH_Renju/DoubleFourCheck.cs @@ -25,8 +25,7 @@ public class DoubleFourCheck : ForbiddenDetectorBase // 임시로 돌 배치 board[row, col] = Black; - // 실제 열린 4 개수 카운트 - int realOpenFourCount = 0; + List openFourDirections = new List(); // 4개의 방향 검사 for (int i = 0; i < 4; i++) @@ -37,19 +36,16 @@ public class DoubleFourCheck : ForbiddenDetectorBase // 이 방향에서 실제 열린 4가 있는지 확인 if (HasRealOpenFour(board, row, col, dir1, dir2)) { - realOpenFourCount++; - if (realOpenFourCount >= 2) + if (HasRealOpenFour(board, row, col, dir1, dir2)) { - // 원래 상태로 되돌리기 - board[row, col] = Space; - return true; // 실제 열린 4가 2개 이상이면 쌍사 + openFourDirections.Add(i); } } } // 원래 상태로 되돌림 board[row, col] = Space; - return false; + return openFourDirections.Count >= 2; } // 특정 방향에 대해 열린 4 검사 diff --git a/Assets/Script/Renju/KSH_Renju/DoubleThreeCheck.cs b/Assets/Script/Renju/KSH_Renju/DoubleThreeCheck.cs index 9ebf7c5..fcacf1a 100644 --- a/Assets/Script/Renju/KSH_Renju/DoubleThreeCheck.cs +++ b/Assets/Script/Renju/KSH_Renju/DoubleThreeCheck.cs @@ -25,36 +25,30 @@ public class DoubleThreeCheck : ForbiddenDetectorBase // 임시로 돌 배치 board[row, col] = Black; - // 실제 열린 3 개수 카운트 - int realOpenThreeCount = 0; + List openThreeDirections = new List(); // 열린 3 저장용 // 4개의 방향 검사 for (int i = 0; i < 4; i++) { int dir1 = DirectionPairs[i, 0]; int dir2 = DirectionPairs[i, 1]; - + // 이 방향에서 실제 열린 3이 있는지 확인 if (HasRealOpenThree(board, row, col, dir1, dir2)) { - realOpenThreeCount++; - if (realOpenThreeCount >= 2) - { - // 원래 상태로 되돌리기 - board[row, col] = Space; - return true; // 실제 열린 3이 2개 이상이면 삼삼 - } + openThreeDirections.Add(i); } } // 원래 상태로 되돌림 board[row, col] = Space; - return false; + + return openThreeDirections.Count >= 2; } // 특정 방향에 대해 열린 3 검사 private bool HasRealOpenThree(Enums.PlayerType[,] board, int row, int col, - int dir1, int dir2) // ref OpenThreeInfo threeInfo + int dir1, int dir2) { // 패턴 추출 Enums.PlayerType[] linePattern = ExtractLinePattern(board, row, col, dir1, dir2);