DO-4 [Test] AI Test 환경 추가
This commit is contained in:
parent
ec5f2d82e7
commit
4cd42862bf
19599
Assets/Script/AI/GameCopy_AI.unity
Normal file
19599
Assets/Script/AI/GameCopy_AI.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Script/AI/GameCopy_AI.unity.meta
Normal file
7
Assets/Script/AI/GameCopy_AI.unity.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e61de5ff6b71b2e45b0878ccd8c8033a
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -88,11 +88,11 @@ public static class MiniMaxAIController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 랜덤 실수
|
// 랜덤 실수
|
||||||
if (secondBestMove != null && UnityEngine.Random.value < _mistakeMove) // UnityEngine.Random.value == 0~1 사이 반환
|
/*if (secondBestMove != null && UnityEngine.Random.value < _mistakeMove) // UnityEngine.Random.value == 0~1 사이 반환
|
||||||
{
|
{
|
||||||
Debug.Log("AI Mistake");
|
Debug.Log("AI Mistake");
|
||||||
return secondBestMove;
|
return secondBestMove;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return bestMove;
|
return bestMove;
|
||||||
}
|
}
|
||||||
|
19
Assets/Script/AI/OmokAI.cs
Normal file
19
Assets/Script/AI/OmokAI.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
public class OmokAI : MonoBehaviour
|
||||||
|
{
|
||||||
|
public static OmokAI Instance;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void StartBestMoveSearch(Enums.PlayerType[,] board, Action<(int, int)?> callback)
|
||||||
|
{
|
||||||
|
(int row, int col)? bestMove = await Task.Run(() => MiniMaxAIController.GetBestMove(board));
|
||||||
|
callback?.Invoke(bestMove);
|
||||||
|
}
|
||||||
|
}
|
3
Assets/Script/AI/OmokAI.cs.meta
Normal file
3
Assets/Script/AI/OmokAI.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 576baa0fe98d40608bf48109ba5ed788
|
||||||
|
timeCreated: 1742286909
|
@ -261,6 +261,24 @@ public class GameLogic : MonoBehaviour
|
|||||||
ReplayManager.Instance.RecordStonePlaced(Enums.StoneType.Black, row, col); //기보 데이터 저장
|
ReplayManager.Instance.RecordStonePlaced(Enums.StoneType.Black, row, col); //기보 데이터 저장
|
||||||
break;
|
break;
|
||||||
case Enums.PlayerType.PlayerB:
|
case Enums.PlayerType.PlayerB:
|
||||||
|
/*
|
||||||
|
// AI 테스트 시작
|
||||||
|
OmokAI.Instance.StartBestMoveSearch(_board, (bestMove) =>
|
||||||
|
{
|
||||||
|
if (bestMove != null)
|
||||||
|
{
|
||||||
|
// 타이머 제대로 30초로 clear안되는 문제. 아마 스레드가 언제 끝나는 지 몰라서 그러는 듯
|
||||||
|
stoneController.SetStoneType(Enums.StoneType.White, bestMove.Value.Item1, bestMove.Value.Item2);
|
||||||
|
stoneController.SetStoneState(Enums.StoneState.LastPositioned, bestMove.Value.Item1, bestMove.Value.Item2);
|
||||||
|
_board[bestMove.Value.Item1, bestMove.Value.Item2] = Enums.PlayerType.PlayerB;
|
||||||
|
LastNSelectedSetting(bestMove.Value.Item1, bestMove.Value.Item2);
|
||||||
|
|
||||||
|
ReplayManager.Instance.RecordStonePlaced(Enums.StoneType.White, bestMove.Value.Item1, bestMove.Value.Item2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// AI 테스트 끝
|
||||||
|
*/
|
||||||
|
|
||||||
stoneController.SetStoneType(Enums.StoneType.White, row, col);
|
stoneController.SetStoneType(Enums.StoneType.White, row, col);
|
||||||
stoneController.SetStoneState(Enums.StoneState.LastPositioned, row, col);
|
stoneController.SetStoneState(Enums.StoneState.LastPositioned, row, col);
|
||||||
_board[row, col] = Enums.PlayerType.PlayerB;
|
_board[row, col] = Enums.PlayerType.PlayerB;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user