DO-89 [Style] 안쓰는 코드 정리

This commit is contained in:
Sehyeon 2025-03-31 14:47:39 +09:00
parent 578e501c94
commit 9426d32ec9
5 changed files with 2 additions and 52 deletions

View File

@ -1,7 +1,5 @@
// AI에서만 사용하는 상수 모음 public class AIConstants
public class AIConstants
{ {
// 방향 상수
public static readonly int[][] Directions = new int[][] public static readonly int[][] Directions = new int[][]
{ {
new int[] {1, 0}, // 수직 new int[] {1, 0}, // 수직

View File

@ -24,12 +24,6 @@ public static class MiniMaxAIController
// 중복 계산을 방지하기 위한 캐싱 데이터. 위치 기반 (그리드 기반 해시맵) // 중복 계산을 방지하기 위한 캐싱 데이터. 위치 기반 (그리드 기반 해시맵)
private static Dictionary<(int row, int col), Dictionary<(int dirX, int dirY), (int count, int openEnds)>> 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)>>(); _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) 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); fiveInARowMoves = GetFiveInARowCandidateMoves(board, Enums.PlayerType.PlayerA);
if (fiveInARowMoves != null & fiveInARowMoves.Count > 0) if (fiveInARowMoves != null & fiveInARowMoves.Count > 0)
{ {

View File

@ -10,12 +10,6 @@ public class OmokAI : Singleton<OmokAI>
{ {
Instance = this; Instance = this;
} }
// AI가 Player B가 아닌 경우 해당 메서드로 설정. 기본값은 PlayerB
public void SetAIPlayerType(Enums.PlayerType AIPlayerType)
{
MiniMaxAIController.SetAIPlayerType(AIPlayerType);
}
public void SetRating(int level) public void SetRating(int level)
{ {
@ -27,8 +21,7 @@ public class OmokAI : Singleton<OmokAI>
(int row, int col)? bestMove = await Task.Run(() => MiniMaxAIController.GetBestMove(board)); (int row, int col)? bestMove = await Task.Run(() => MiniMaxAIController.GetBestMove(board));
callback?.Invoke(bestMove); callback?.Invoke(bestMove);
} }
// true: Win, false: Lose
public bool CheckGameWin(Enums.PlayerType player, Enums.PlayerType[,] board, int row, int col) public bool CheckGameWin(Enums.PlayerType player, Enums.PlayerType[,] board, int row, int col)
{ {
bool isWin = MiniMaxAIController.CheckGameWin(player, board, row, col, false); bool isWin = MiniMaxAIController.CheckGameWin(player, board, row, col, false);

View File

@ -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; return linePattern;
} }
} }

View File

@ -6,8 +6,6 @@ using UnityEngine;
public class RenjuForbiddenMoveDetector : ForbiddenDetectorBase public class RenjuForbiddenMoveDetector : ForbiddenDetectorBase
{ {
// 렌주 룰 금수 감지기 생성 // 렌주 룰 금수 감지기 생성
/*private RenjuDoubleFourDetector _doubleFourDetactor = new();
private RenjuDoubleThreeDetector _doubleThreeDetector = new();*/
private RenjuOverlineDetector _overlineDetactor = new(); private RenjuOverlineDetector _overlineDetactor = new();
private DoubleFourCheck _doubleFourDetactor = new(); // DoubleFourCheck private DoubleFourCheck _doubleFourDetactor = new(); // DoubleFourCheck
private DoubleThreeCheck _doubleThreeDetector = new(); // DoubleThreeCheck private DoubleThreeCheck _doubleThreeDetector = new(); // DoubleThreeCheck