DO-41 [Cmoment] 무승부 관련 코드 주석 추가
This commit is contained in:
parent
e6918e0d18
commit
b18edb680d
@ -387,7 +387,7 @@ public class GameLogic : MonoBehaviour
|
|||||||
{
|
{
|
||||||
return _board;
|
return _board;
|
||||||
}
|
}
|
||||||
|
//무승부 확인
|
||||||
public bool CheckGameDraw(Enums.PlayerType[,] board)
|
public bool CheckGameDraw(Enums.PlayerType[,] board)
|
||||||
{
|
{
|
||||||
if (CheckIsFull(board)) return true; // 빈 칸이 없으면 무승부
|
if (CheckIsFull(board)) return true; // 빈 칸이 없으면 무승부
|
||||||
@ -396,6 +396,7 @@ public class GameLogic : MonoBehaviour
|
|||||||
return !(playerAHasChance || playerBHasChance); // 둘 다 기회가 없으면 무승부
|
return !(playerAHasChance || playerBHasChance); // 둘 다 기회가 없으면 무승부
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//연속되는 5개가 만들어질 기회가 있는지 판단
|
||||||
private bool CheckFiveChance(Enums.PlayerType[,] board, Enums.PlayerType player)
|
private bool CheckFiveChance(Enums.PlayerType[,] board, Enums.PlayerType player)
|
||||||
{
|
{
|
||||||
var tempBoard = (Enums.PlayerType[,])board.Clone();
|
var tempBoard = (Enums.PlayerType[,])board.Clone();
|
||||||
@ -411,14 +412,13 @@ public class GameLogic : MonoBehaviour
|
|||||||
var (count, _) = CountStones(tempBoard, row, col, dir, player);
|
var (count, _) = CountStones(tempBoard, row, col, dir, player);
|
||||||
|
|
||||||
// 자기 자신 포함하여 5개 이상일 시 true 반환
|
// 자기 자신 포함하여 5개 이상일 시 true 반환
|
||||||
if (count + 1 >= WIN_COUNT)
|
if (count + 1 >= WIN_COUNT) return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
//보드가 꽉 찼는지 확인
|
||||||
private static bool CheckIsFull(Enums.PlayerType[,] board)
|
private static bool CheckIsFull(Enums.PlayerType[,] board)
|
||||||
{
|
{
|
||||||
int size = board.GetLength(0);
|
int size = board.GetLength(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user