From a418cb1a3e89c5c78bc11ec885b9b67c99723266 Mon Sep 17 00:00:00 2001 From: Lim0_C Date: Wed, 19 Mar 2025 17:49:34 +0900 Subject: [PATCH 1/7] =?UTF-8?q?DO-41=20[Feat]=20=EB=AC=B4=EC=8A=B9?= =?UTF-8?q?=EB=B6=80=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 빈칸이 없이 채우면 무승부 --- Assets/Script/Game/GameLogic.cs | 35 ++++++++++++++++++++++++++++++- Assets/Script/Game/GameManager.cs | 8 +++---- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Assets/Script/Game/GameLogic.cs b/Assets/Script/Game/GameLogic.cs index 94c54f0..764c7c5 100644 --- a/Assets/Script/Game/GameLogic.cs +++ b/Assets/Script/Game/GameLogic.cs @@ -25,7 +25,15 @@ public abstract class BasePlayerState else { //TODO: 무승부 확인 - HandleNextTurn(gameLogic); + if (gameLogic.CheckGameDraw(gameLogic.GetBoard())) + { + GameManager.Instance.panelManager.OpenConfirmPanel($"Game Over: Draw",() =>{}); + gameLogic.EndGame(); + } + else + { + HandleNextTurn(gameLogic); + } } } @@ -376,6 +384,31 @@ public class GameLogic : MonoBehaviour return (count, openEnds); } + public Enums.PlayerType[,] GetBoard() + { + return _board; + } + + public bool CheckGameDraw(Enums.PlayerType[,] board) + { + List<(int, int)> validMoves = new List<(int, int)>(); + int size = board.GetLength(0); + for (int row = 0; row < size; row++) + { + for (int col = 0; col < size; col++) + { + if (board[row, col] == Enums.PlayerType.None) + { + validMoves.Add((row, col)); + } + } + } + + if (validMoves.Count == 0) return true; + + return false; + } + #region Renju Rule Detector // 금수 위치 업데이트 및 표시 private void UpdateForbiddenMoves() diff --git a/Assets/Script/Game/GameManager.cs b/Assets/Script/Game/GameManager.cs index 628fb66..c6ec223 100644 --- a/Assets/Script/Game/GameManager.cs +++ b/Assets/Script/Game/GameManager.cs @@ -31,10 +31,10 @@ public class GameManager : Singleton //게임 씬에서 확인하기 위한 임시 코드 // _canvas = canvas.GetComponent(); - // _stoneController = GameObject.FindObjectOfType(); - // _stoneController.InitStones(); - // var fioTimer = FindObjectOfType(); - // _gameLogic = new GameLogic(_stoneController, _gameType, fioTimer); + _stoneController = GameObject.FindObjectOfType(); + _stoneController.InitStones(); + var fioTimer = FindObjectOfType(); + _gameLogic = new GameLogic(_stoneController, _gameType, fioTimer); } private void InitPanels() From 0c4f59b9e5fccb4d3ce57079c2aec834eb17491c Mon Sep 17 00:00:00 2001 From: Lim0_C Date: Thu, 20 Mar 2025 14:12:54 +0900 Subject: [PATCH 2/7] =?UTF-8?q?DO-41=20[Feat]=20=EB=AC=B4=EC=8A=B9?= =?UTF-8?q?=EB=B6=80=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/LYC/GameCopyLYC.unity | 114 +++++++++++++++++++++++++++++++- Assets/Script/Game/GameLogic.cs | 41 +++++++++--- 2 files changed, 145 insertions(+), 10 deletions(-) diff --git a/Assets/LYC/GameCopyLYC.unity b/Assets/LYC/GameCopyLYC.unity index 6f0d1e8..19e0448 100644 --- a/Assets/LYC/GameCopyLYC.unity +++ b/Assets/LYC/GameCopyLYC.unity @@ -8175,6 +8175,8 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1118625358} + - component: {fileID: 1118625360} + - component: {fileID: 1118625359} m_Layer: 0 m_Name: GameManager m_TagString: Untagged @@ -8197,6 +8199,116 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1118625359 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1118625357} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 35a4c6d5d3a97b444b968e68ec8bb9f7, type: 3} + m_Name: + m_EditorClassIdentifier: + panelManagerPrefab: {fileID: 3475740041361426276, guid: 085ca07ca90c92545b2594bd13412701, type: 3} + audioManagerPrefab: {fileID: 2946408323859178723, guid: e829818dce39a5d4383e061111bed871, type: 3} +--- !u!82 &1118625360 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1118625357} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1001 &1121996003 PrefabInstance: m_ObjectHideFlags: 0 @@ -17421,7 +17533,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7155909258766834886, guid: b1a31da84076a534cae7cb20a7913a93, type: 3} propertyPath: m_Name - value: '[Canvas] Game UI' + value: Canvas objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] diff --git a/Assets/Script/Game/GameLogic.cs b/Assets/Script/Game/GameLogic.cs index 764c7c5..fdea953 100644 --- a/Assets/Script/Game/GameLogic.cs +++ b/Assets/Script/Game/GameLogic.cs @@ -212,7 +212,6 @@ public class GameLogic : MonoBehaviour //TODO: 기보 매니저에게 플레이어 닉네임 넘겨주기 ReplayManager.Instance.InitReplayData("PlayerA","nicknameB"); - switch (gameType) { @@ -229,6 +228,7 @@ public class GameLogic : MonoBehaviour break; } } + //착수 버튼 클릭시 호출되는 함수 public void OnConfirm() { @@ -327,7 +327,6 @@ public class GameLogic : MonoBehaviour public void EndGame() { SetState(null); - } //승리 확인 함수 @@ -391,25 +390,49 @@ public class GameLogic : MonoBehaviour public bool CheckGameDraw(Enums.PlayerType[,] board) { - List<(int, int)> validMoves = new List<(int, int)>(); + if (CheckIsFull(board)) return true; // 빈 칸이 없으면 무승부 + bool playerAHasChance = CheckFiveChance(board, Enums.PlayerType.PlayerA); + bool playerBHasChance = CheckFiveChance(board, Enums.PlayerType.PlayerB); + return !(playerAHasChance || playerBHasChance); // 둘 다 기회가 없으면 무승부 + } + + private bool CheckFiveChance(Enums.PlayerType[,] board, Enums.PlayerType player) + { + var tempBoard = (Enums.PlayerType[,])board.Clone(); int size = board.GetLength(0); for (int row = 0; row < size; row++) { for (int col = 0; col < size; col++) { - if (board[row, col] == Enums.PlayerType.None) + if (tempBoard[row, col] != Enums.PlayerType.None) continue; + tempBoard[row, col] = player; + foreach (var dir in _directions) { - validMoves.Add((row, col)); + var (count, _) = CountStones(tempBoard, row, col, dir, player); + + // 자기 자신 포함하여 5개 이상일 시 true 반환 + if (count + 1 >= WIN_COUNT) + return true; } } } - - if (validMoves.Count == 0) return true; - return false; } -#region Renju Rule Detector + private static bool CheckIsFull(Enums.PlayerType[,] board) + { + int size = board.GetLength(0); + for (int row = 0; row < size; row++) + { + for (int col = 0; col < size; col++) + { + if (board[row, col] == Enums.PlayerType.None) return false; + } + } + return true; + } + + #region Renju Rule Detector // 금수 위치 업데이트 및 표시 private void UpdateForbiddenMoves() { From b18edb680d43d47794a237c9c27bef2e3138d51e Mon Sep 17 00:00:00 2001 From: Lim0_C Date: Thu, 20 Mar 2025 15:35:00 +0900 Subject: [PATCH 3/7] =?UTF-8?q?DO-41=20[Cmoment]=20=EB=AC=B4=EC=8A=B9?= =?UTF-8?q?=EB=B6=80=20=EA=B4=80=EB=A0=A8=20=EC=BD=94=EB=93=9C=20=EC=A3=BC?= =?UTF-8?q?=EC=84=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Script/Game/GameLogic.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Assets/Script/Game/GameLogic.cs b/Assets/Script/Game/GameLogic.cs index fdea953..9462648 100644 --- a/Assets/Script/Game/GameLogic.cs +++ b/Assets/Script/Game/GameLogic.cs @@ -387,7 +387,7 @@ public class GameLogic : MonoBehaviour { return _board; } - + //무승부 확인 public bool CheckGameDraw(Enums.PlayerType[,] board) { if (CheckIsFull(board)) return true; // 빈 칸이 없으면 무승부 @@ -396,6 +396,7 @@ public class GameLogic : MonoBehaviour return !(playerAHasChance || playerBHasChance); // 둘 다 기회가 없으면 무승부 } + //연속되는 5개가 만들어질 기회가 있는지 판단 private bool CheckFiveChance(Enums.PlayerType[,] board, Enums.PlayerType player) { var tempBoard = (Enums.PlayerType[,])board.Clone(); @@ -411,14 +412,13 @@ public class GameLogic : MonoBehaviour var (count, _) = CountStones(tempBoard, row, col, dir, player); // 자기 자신 포함하여 5개 이상일 시 true 반환 - if (count + 1 >= WIN_COUNT) - return true; + if (count + 1 >= WIN_COUNT) return true; } } } return false; } - + //보드가 꽉 찼는지 확인 private static bool CheckIsFull(Enums.PlayerType[,] board) { int size = board.GetLength(0); From e5f8b4240b53f7b6e64932b23585bbff6d2b0611 Mon Sep 17 00:00:00 2001 From: Lim0_C Date: Thu, 20 Mar 2025 16:40:08 +0900 Subject: [PATCH 4/7] =?UTF-8?q?DO-41=20[Fix]=20=EC=A4=91=EB=B3=B5=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Script/Game/GameLogic.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Assets/Script/Game/GameLogic.cs b/Assets/Script/Game/GameLogic.cs index a09ddfd..c01db5b 100644 --- a/Assets/Script/Game/GameLogic.cs +++ b/Assets/Script/Game/GameLogic.cs @@ -233,12 +233,6 @@ public class GameLogic : MonoBehaviour break; } } - - public Enums.PlayerType[,] GetBoard() - { - return _board; - } - //착수 버튼 클릭시 호출되는 함수 public void OnConfirm() @@ -339,6 +333,7 @@ public class GameLogic : MonoBehaviour public void EndGame() { SetState(null); + //TODO: 게임 종료 후 행동 구현 } //승리 확인 함수 From 5b1ddd7a953211cd5eb6415a8bce1f1adf2a4559 Mon Sep 17 00:00:00 2001 From: Lim0_C Date: Thu, 20 Mar 2025 17:22:20 +0900 Subject: [PATCH 5/7] =?UTF-8?q?DO-41=20[Feat]=20=EB=AC=B4=EC=8A=B9?= =?UTF-8?q?=EB=B6=80=20=ED=8C=90=EB=8B=A8=20=EC=B5=9C=EC=86=8C=20=EC=B0=A9?= =?UTF-8?q?=EC=88=98=20=EA=B0=92=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 최소 착수 값 이하일 경우 무승부 판단을 false로 반환 --- Assets/Script/Game/GameLogic.cs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Assets/Script/Game/GameLogic.cs b/Assets/Script/Game/GameLogic.cs index c01db5b..5ced4d7 100644 --- a/Assets/Script/Game/GameLogic.cs +++ b/Assets/Script/Game/GameLogic.cs @@ -12,10 +12,10 @@ public abstract class BasePlayerState public void ProcessMove(GameLogic gameLogic, Enums.PlayerType playerType, int row, int col) { - gameLogic.fioTimer.PauseTimer(); gameLogic.SetNewBoardValue(playerType, row, col); + gameLogic.CountStoneCounter(); if (gameLogic.CheckGameWin(playerType, row, col)) { @@ -24,7 +24,6 @@ public abstract class BasePlayerState } else { - //TODO: 무승부 확인 if (gameLogic.CheckGameDraw(gameLogic.GetBoard())) { GameManager.Instance.panelManager.OpenConfirmPanel($"Game Over: Draw",() =>{}); @@ -145,17 +144,26 @@ public class GameLogic : MonoBehaviour public StoneController stoneController; public Enums.PlayerType currentTurn; public Enums.GameType gameType; + //총 착수된 돌 카운터 + private int _totalStoneCounter = 0; + public int TotalStoneCounter{get{return _totalStoneCounter;}} + public BasePlayerState firstPlayerState; public BasePlayerState secondPlayerState; private BasePlayerState _currentPlayerState; + //타이머 public FioTimer fioTimer; private const int WIN_COUNT = 5; + //무승부 확인을 위한 최소 착수 수 + private const int MinCountForDrawCheck = 150; //선택된 좌표 public int selectedRow; public int selectedCol; //마지막 배치된 좌표 - + private int _lastRow; + private int _lastCol; + #region Renju Members // 렌주룰 금수 검사기 private RenjuForbiddenMoveDetector _forbiddenDetector; @@ -164,9 +172,6 @@ public class GameLogic : MonoBehaviour private List _forbiddenMoves = new List(); #endregion - private int _lastRow; - private int _lastCol; - private static int[][] _directions = new int[][] { new int[] {1, 0}, // 수직 @@ -233,6 +238,11 @@ public class GameLogic : MonoBehaviour break; } } + //돌 카운터 증가 함수 + public void CountStoneCounter() + { + _totalStoneCounter++; + } //착수 버튼 클릭시 호출되는 함수 public void OnConfirm() @@ -397,6 +407,7 @@ public class GameLogic : MonoBehaviour //무승부 확인 public bool CheckGameDraw(Enums.PlayerType[,] board) { + if (_totalStoneCounter < MinCountForDrawCheck) return false; //최소 착수 수보다 작으면 false 리턴 if (CheckIsFull(board)) return true; // 빈 칸이 없으면 무승부 bool playerAHasChance = CheckFiveChance(board, Enums.PlayerType.PlayerA); bool playerBHasChance = CheckFiveChance(board, Enums.PlayerType.PlayerB); From 31b2ebee9fd4377cb4a01a00ecda23b79bd2356a Mon Sep 17 00:00:00 2001 From: Lim0_C Date: Fri, 21 Mar 2025 09:42:45 +0900 Subject: [PATCH 6/7] =?UTF-8?q?DO-41=20[Refactor]=20=EB=AC=B4=EC=8A=B9?= =?UTF-8?q?=EB=B6=80=20=EA=B4=80=EB=A0=A8=20=EC=BD=94=EB=93=9C=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WIN_COUNT, MinCountForDrawCheck를 Constants로 옮김 최소 착수 값 위치를 조정 --- Assets/LYC/GameCopyLYC.unity | 45 +++++++++++++++++++++++++++++++ Assets/Script/Common/Constants.cs | 3 +++ Assets/Script/Game/GameLogic.cs | 33 ++++++++++++----------- 3 files changed, 66 insertions(+), 15 deletions(-) diff --git a/Assets/LYC/GameCopyLYC.unity b/Assets/LYC/GameCopyLYC.unity index 19e0448..406f480 100644 --- a/Assets/LYC/GameCopyLYC.unity +++ b/Assets/LYC/GameCopyLYC.unity @@ -6020,6 +6020,50 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9726acf6f82a3644ba31eda5ef496991, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &820078853 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 820078855} + - component: {fileID: 820078854} + m_Layer: 0 + m_Name: OmokAI + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &820078854 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 820078853} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 576baa0fe98d40608bf48109ba5ed788, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &820078855 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 820078853} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 540, y: 1760, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &831992430 PrefabInstance: m_ObjectHideFlags: 0 @@ -17550,3 +17594,4 @@ SceneRoots: - {fileID: 307507522} - {fileID: 1632066875} - {fileID: 1118625358} + - {fileID: 820078855} diff --git a/Assets/Script/Common/Constants.cs b/Assets/Script/Common/Constants.cs index 9cd5c76..8fae832 100644 --- a/Assets/Script/Common/Constants.cs +++ b/Assets/Script/Common/Constants.cs @@ -4,4 +4,7 @@ public const string GameServerURL = "ws://localhost:3000"; public const int BoardSize = 15; public const int ReplayMaxRecordSize = 10; + public const int WIN_COUNT = 5; + //무승부 확인을 위한 최소 착수 수 + public const int MinCountForDrawCheck = 150; } \ No newline at end of file diff --git a/Assets/Script/Game/GameLogic.cs b/Assets/Script/Game/GameLogic.cs index 5ced4d7..28b2d2f 100644 --- a/Assets/Script/Game/GameLogic.cs +++ b/Assets/Script/Game/GameLogic.cs @@ -24,17 +24,23 @@ public abstract class BasePlayerState } else { - if (gameLogic.CheckGameDraw(gameLogic.GetBoard())) + if (gameLogic.TotalStoneCounter >= Constants.MinCountForDrawCheck) { - GameManager.Instance.panelManager.OpenConfirmPanel($"Game Over: Draw",() =>{}); - gameLogic.EndGame(); + if (gameLogic.CheckGameDraw()) + { + GameManager.Instance.panelManager.OpenConfirmPanel($"Game Over: Draw",() =>{}); + gameLogic.EndGame(); + } + else + { + HandleNextTurn(gameLogic); + } } else { HandleNextTurn(gameLogic); } } - } } @@ -145,7 +151,7 @@ public class GameLogic : MonoBehaviour public Enums.PlayerType currentTurn; public Enums.GameType gameType; //총 착수된 돌 카운터 - private int _totalStoneCounter = 0; + public int _totalStoneCounter; public int TotalStoneCounter{get{return _totalStoneCounter;}} public BasePlayerState firstPlayerState; @@ -154,9 +160,6 @@ public class GameLogic : MonoBehaviour //타이머 public FioTimer fioTimer; - private const int WIN_COUNT = 5; - //무승부 확인을 위한 최소 착수 수 - private const int MinCountForDrawCheck = 150; //선택된 좌표 public int selectedRow; public int selectedCol; @@ -186,6 +189,7 @@ public class GameLogic : MonoBehaviour _board = new Enums.PlayerType[15, 15]; this.stoneController = stoneController; this.gameType = gameType; + _totalStoneCounter = 0; selectedRow = -1; selectedCol = -1; @@ -354,7 +358,7 @@ public class GameLogic : MonoBehaviour var (count, _) = CountStones(_board, row, col, dir, player); // 자기 자신 포함하여 5개 이상일 시 true 반환 - if (count + 1 >= WIN_COUNT) + if (count + 1 >= Constants.WIN_COUNT) return true; } @@ -405,12 +409,11 @@ public class GameLogic : MonoBehaviour return _board; } //무승부 확인 - public bool CheckGameDraw(Enums.PlayerType[,] board) + public bool CheckGameDraw() { - if (_totalStoneCounter < MinCountForDrawCheck) return false; //최소 착수 수보다 작으면 false 리턴 - if (CheckIsFull(board)) return true; // 빈 칸이 없으면 무승부 - bool playerAHasChance = CheckFiveChance(board, Enums.PlayerType.PlayerA); - bool playerBHasChance = CheckFiveChance(board, Enums.PlayerType.PlayerB); + if (CheckIsFull(_board)) return true; // 빈 칸이 없으면 무승부 + bool playerAHasChance = CheckFiveChance(_board, Enums.PlayerType.PlayerA); + bool playerBHasChance = CheckFiveChance(_board, Enums.PlayerType.PlayerB); return !(playerAHasChance || playerBHasChance); // 둘 다 기회가 없으면 무승부 } @@ -430,7 +433,7 @@ public class GameLogic : MonoBehaviour var (count, _) = CountStones(tempBoard, row, col, dir, player); // 자기 자신 포함하여 5개 이상일 시 true 반환 - if (count + 1 >= WIN_COUNT) return true; + if (count + 1 >= Constants.WIN_COUNT) return true; } } } From b4d34bd3f2e2eb8de5bc2ede615ddf9808fd5b60 Mon Sep 17 00:00:00 2001 From: Lim0_C Date: Fri, 21 Mar 2025 09:55:56 +0900 Subject: [PATCH 7/7] =?UTF-8?q?DO-41=20[Style]=20=EC=A3=BC=EC=84=9D=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC=20=EB=B0=8F=20Debug.Log=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Script/Game/GameLogic.cs | 1 - Assets/Script/Game/GameManager.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/Assets/Script/Game/GameLogic.cs b/Assets/Script/Game/GameLogic.cs index 28b2d2f..206c4b7 100644 --- a/Assets/Script/Game/GameLogic.cs +++ b/Assets/Script/Game/GameLogic.cs @@ -98,7 +98,6 @@ public class AIState: BasePlayerState public override void OnEnter(GameLogic gameLogic) { gameLogic.fioTimer.StartTimer(); - //TODO: AI이식 OmokAI.Instance.StartBestMoveSearch(gameLogic.GetBoard(), (bestMove) => { if(bestMove.HasValue) diff --git a/Assets/Script/Game/GameManager.cs b/Assets/Script/Game/GameManager.cs index 67e9382..b2b3d65 100644 --- a/Assets/Script/Game/GameManager.cs +++ b/Assets/Script/Game/GameManager.cs @@ -51,7 +51,6 @@ public class GameManager : Singleton } else { - Debug.Log("착수 위치를 선택 해주세요"); //TODO: 착수할 위치를 선택하라는 동작 } }