diff --git a/Assets/Script/Renju/ForbiddenDetectorBase.cs b/Assets/Script/Renju/ForbiddenDetectorBase.cs
index 12c35a9..24741c8 100644
--- a/Assets/Script/Renju/ForbiddenDetectorBase.cs
+++ b/Assets/Script/Renju/ForbiddenDetectorBase.cs
@@ -24,15 +24,15 @@
private protected readonly int[,] DirectionPairs = { { 0, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 } };
// 15*15 보드 사이즈
- private protected int _boardSize = Constants.BoardSize;
+ private protected int BoardSize = Constants.BoardSize;
///
/// 좌표가 보드 범위 내에 있는지 확인
///
private protected bool IsInBounds(int row, int col)
{
- var inBoardSizeRow = row >= 0 && row < _boardSize;
- var inBoardSizeCol = col >= 0 && col < _boardSize;
+ var inBoardSizeRow = row >= 0 && row < BoardSize;
+ var inBoardSizeCol = col >= 0 && col < BoardSize;
return inBoardSizeRow && inBoardSizeCol;
}
@@ -44,6 +44,6 @@
{
if (!IsInBounds(row, col)) return false;
- return board[row, col] == Enums.PlayerType.None;
+ return board[row, col] == Space;
}
}
\ No newline at end of file
diff --git a/Assets/Script/Renju/RenjuForbiddenMoveDetector.cs b/Assets/Script/Renju/RenjuForbiddenMoveDetector.cs
index b6d6789..88e97a3 100644
--- a/Assets/Script/Renju/RenjuForbiddenMoveDetector.cs
+++ b/Assets/Script/Renju/RenjuForbiddenMoveDetector.cs
@@ -1,21 +1,11 @@
using System.Collections.Generic;
using UnityEngine;
-///
-/// 렌주 규칙의 모든 금수 규칙(3-3, 4-4, 장목)을 검사하는 통합 클래스
-///
+
public class RenjuForbiddenMoveDetector
{
- private RenjuRuleChecker _ruleChecker;
-
- ///
- /// 렌주 금수 감지기 생성자
- ///
- public RenjuForbiddenMoveDetector()
- {
- // 감지기 초기화
- _ruleChecker = new RenjuRuleChecker();
- }
+ // 렌주 룰 금수 감지기 생성
+ private RenjuRuleChecker _ruleChecker = new RenjuRuleChecker();
///
/// 렌주 룰로 금수 리스트를 반환하는 함수
@@ -24,9 +14,6 @@ public class RenjuForbiddenMoveDetector
/// 금수 좌표를 담은 리스트
public List RenjuForbiddenMove(Enums.PlayerType[,] board)
{
- var doubleThreeList = _ruleChecker.GetForbiddenMoves(board);
-
- return doubleThreeList;
+ return _ruleChecker.GetForbiddenMoves(board);
}
-
}
\ No newline at end of file
diff --git a/Assets/Script/Renju/RenjuOverlineDetector.cs b/Assets/Script/Renju/RenjuOverlineDetector.cs
index f9646a6..37161b0 100644
--- a/Assets/Script/Renju/RenjuOverlineDetector.cs
+++ b/Assets/Script/Renju/RenjuOverlineDetector.cs
@@ -74,7 +74,6 @@
/// 시작 행
/// 시작 열
/// 방향 인덱스
- /// 검사할 플레이어 타입
/// 해당 방향의 연속된 돌 개수
private int CountInDirection(Enums.PlayerType[,] board, int startRow, int startCol, int dirIndex)
{
@@ -82,7 +81,7 @@
int dRow = Directions[dirIndex, 0];
int dCol = Directions[dirIndex, 1];
- for (int i = 1; i < _boardSize; i++)
+ for (int i = 1; i < BoardSize; i++)
{
int newRow = startRow + dRow * i;
int newCol = startCol + dCol * i;
diff --git a/Assets/Script/Renju/RenjuRuleChecker.cs b/Assets/Script/Renju/RenjuRuleChecker.cs
index 7beab19..8cdf082 100644
--- a/Assets/Script/Renju/RenjuRuleChecker.cs
+++ b/Assets/Script/Renju/RenjuRuleChecker.cs
@@ -1,6 +1,9 @@
using System.Collections.Generic;
using UnityEngine;
+///
+/// 렌주 규칙의 모든 금수 규칙(3-3, 4-4, 장목)을 검사하는 통합 클래스
+///
public class RenjuRuleChecker: ForbiddenDetectorBase
{
private RenjuOverlineDetector _overlineDetactor = new();
@@ -10,9 +13,9 @@ public class RenjuRuleChecker: ForbiddenDetectorBase
public List GetForbiddenMoves(Enums.PlayerType[,] board)
{
List forbiddenMoves = new();
- for (int row = 0; row < _boardSize; row++)
+ for (int row = 0; row < BoardSize; row++)
{
- for (int col = 0; col < _boardSize; col++)
+ for (int col = 0; col < BoardSize; col++)
{
// ** 비어 있지 않으면 검사할 필요 없음 **
if (!IsEmptyPosition(board, row, col)) continue;