From 9426d32ec94f00db102c85972cad597d660d62be Mon Sep 17 00:00:00 2001 From: Sehyeon Date: Mon, 31 Mar 2025 14:47:39 +0900 Subject: [PATCH] =?UTF-8?q?DO-89=20[Style]=20=EC=95=88=EC=93=B0=EB=8A=94?= =?UTF-8?q?=20=EC=BD=94=EB=93=9C=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Script/AI/AIConstants.cs | 4 +-- Assets/Script/AI/MiniMaxAIController.cs | 7 ---- Assets/Script/AI/OmokAI.cs | 9 +----- .../Script/Renju/KSH_Renju/DoubleFourCheck.cs | 32 ------------------- .../Renju/RenjuForbiddenMoveDetector.cs | 2 -- 5 files changed, 2 insertions(+), 52 deletions(-) diff --git a/Assets/Script/AI/AIConstants.cs b/Assets/Script/AI/AIConstants.cs index 647b089..3446bb2 100644 --- a/Assets/Script/AI/AIConstants.cs +++ b/Assets/Script/AI/AIConstants.cs @@ -1,7 +1,5 @@ -// AI에서만 사용하는 상수 모음 -public class AIConstants +public class AIConstants { - // 방향 상수 public static readonly int[][] Directions = new int[][] { new int[] {1, 0}, // 수직 diff --git a/Assets/Script/AI/MiniMaxAIController.cs b/Assets/Script/AI/MiniMaxAIController.cs index 5952707..e7f4b91 100644 --- a/Assets/Script/AI/MiniMaxAIController.cs +++ b/Assets/Script/AI/MiniMaxAIController.cs @@ -24,12 +24,6 @@ public static class MiniMaxAIController // 중복 계산을 방지하기 위한 캐싱 데이터. 위치 기반 (그리드 기반 해시맵) private static Dictionary<(int row, int col), Dictionary<(int dirX, int dirY), (int count, int openEnds)>> _spatialStoneCache = new Dictionary<(int row, int col), Dictionary<(int dirX, int dirY), (int count, int openEnds)>>(); - - // AI Player Type 변경 (AI가 선수로 둘 수 있을지도 모르니..) - public static void SetAIPlayerType(Enums.PlayerType AIPlayerType) - { - _AIPlayerType = AIPlayerType; - } // 급수 설정 -> 실수 넣을 때 계산 public static void SetRating(int level) @@ -72,7 +66,6 @@ public static class MiniMaxAIController } // 즉시 패배 가능한 자리를 먼저 찾아서 우선적으로 설정 - // var oppositePlayer = _AIPlayerType == Enums.PlayerType.PlayerB ? Enums.PlayerType.PlayerA : Enums.PlayerType.PlayerB; fiveInARowMoves = GetFiveInARowCandidateMoves(board, Enums.PlayerType.PlayerA); if (fiveInARowMoves != null & fiveInARowMoves.Count > 0) { diff --git a/Assets/Script/AI/OmokAI.cs b/Assets/Script/AI/OmokAI.cs index 50bee90..1b15051 100644 --- a/Assets/Script/AI/OmokAI.cs +++ b/Assets/Script/AI/OmokAI.cs @@ -10,12 +10,6 @@ public class OmokAI : Singleton { Instance = this; } - - // AI가 Player B가 아닌 경우 해당 메서드로 설정. 기본값은 PlayerB - public void SetAIPlayerType(Enums.PlayerType AIPlayerType) - { - MiniMaxAIController.SetAIPlayerType(AIPlayerType); - } public void SetRating(int level) { @@ -27,8 +21,7 @@ public class OmokAI : Singleton (int row, int col)? bestMove = await Task.Run(() => MiniMaxAIController.GetBestMove(board)); callback?.Invoke(bestMove); } - - // true: Win, false: Lose + public bool CheckGameWin(Enums.PlayerType player, Enums.PlayerType[,] board, int row, int col) { bool isWin = MiniMaxAIController.CheckGameWin(player, board, row, col, false); diff --git a/Assets/Script/Renju/KSH_Renju/DoubleFourCheck.cs b/Assets/Script/Renju/KSH_Renju/DoubleFourCheck.cs index b03986b..e4460d3 100644 --- a/Assets/Script/Renju/KSH_Renju/DoubleFourCheck.cs +++ b/Assets/Script/Renju/KSH_Renju/DoubleFourCheck.cs @@ -228,38 +228,6 @@ public class DoubleFourCheck : ForbiddenDetectorBase } } - /*// dir1 방향으로 패턴 채우기 - for (int i = 1; i <= 5; i++) - { - int newRow = row + Directions[dir1, 0] * i; - int newCol = col + Directions[dir1, 1] * i; - - if (IsInBounds(newRow, newCol)) - { - linePattern[centerIndex + i] = board[newRow, newCol]; - } - else - { - linePattern[centerIndex + i] = White; // 범위 밖은 벽으로 처리하여 일관성 유지 - } - } - - // dir2 방향으로 패턴 채우기 - for (int i = 1; i <= 5; i++) - { - int newRow = row + Directions[dir2, 0] * i; - int newCol = col + Directions[dir2, 1] * i; - - if (IsInBounds(newRow, newCol)) - { - linePattern[centerIndex - i] = board[newRow, newCol]; - } - else - { - linePattern[centerIndex - i] = White; // 범위 밖은 벽으로 처리하여 일관성 유지 - } - }*/ - return linePattern; } } \ No newline at end of file diff --git a/Assets/Script/Renju/RenjuForbiddenMoveDetector.cs b/Assets/Script/Renju/RenjuForbiddenMoveDetector.cs index d523480..9a69dcb 100644 --- a/Assets/Script/Renju/RenjuForbiddenMoveDetector.cs +++ b/Assets/Script/Renju/RenjuForbiddenMoveDetector.cs @@ -6,8 +6,6 @@ using UnityEngine; public class RenjuForbiddenMoveDetector : ForbiddenDetectorBase { // 렌주 룰 금수 감지기 생성 - /*private RenjuDoubleFourDetector _doubleFourDetactor = new(); - private RenjuDoubleThreeDetector _doubleThreeDetector = new();*/ private RenjuOverlineDetector _overlineDetactor = new(); private DoubleFourCheck _doubleFourDetactor = new(); // DoubleFourCheck private DoubleThreeCheck _doubleThreeDetector = new(); // DoubleThreeCheck