From 88493e2236978bbfe6c2498466a71eafb4f8594f Mon Sep 17 00:00:00 2001 From: se_ga Date: Thu, 26 Feb 2026 17:23:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=AF=D0=B4=D1=80=D0=BE=20=D0=B0=D0=B4=D0=B0?= =?UTF-8?q?=D0=BF=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BE=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=B4=20=D0=BB=D1=8E=D0=B1=D0=BE=D0=B9=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B7=D0=BC=D0=B5=D1=80=20=D0=BF=D0=BE=D0=BB=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Fonts/NEW/NexaRegular COOL.asset | 2 +- Assets/Scenes/GameScene3D.unity | 3 +++ Assets/Scripts/GameFSM/ClearFieldState.cs | 8 ++++---- Assets/Scripts/GameFSM/PositioningState.cs | 2 +- Assets/Scripts/GameManager.cs | 5 +++-- Assets/Scripts/Inputs/In.cs | 24 +++++++++++----------- Assets/Scripts/Solver.cs | 9 +++++--- 7 files changed, 30 insertions(+), 23 deletions(-) diff --git a/Assets/Fonts/NEW/NexaRegular COOL.asset b/Assets/Fonts/NEW/NexaRegular COOL.asset index f19f222..c0f85e5 100644 --- a/Assets/Fonts/NEW/NexaRegular COOL.asset +++ b/Assets/Fonts/NEW/NexaRegular COOL.asset @@ -11349,7 +11349,7 @@ Material: - _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767} - _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0} - _FaceColor: {r: 1, g: 1, b: 1, a: 1} - - _GlowColor: {r: 0.47417736, g: 0, b: 1, a: 1} + - _GlowColor: {r: 0.6417732, g: 0, b: 1, a: 1} - _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767} - _OutlineColor: {r: 0.554717, g: 0.554717, b: 0.554717, a: 1} - _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Scenes/GameScene3D.unity b/Assets/Scenes/GameScene3D.unity index 8a7969d..006fc8e 100644 --- a/Assets/Scenes/GameScene3D.unity +++ b/Assets/Scenes/GameScene3D.unity @@ -6005,10 +6005,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 0427b50b8b84b5641a0188046aaee227, type: 3} m_Name: m_EditorClassIdentifier: + Rows: 7 + Cols: 7 dummyBots: 0 botsAmount: 5 dummyPreset: {fileID: 11400000, guid: 35ba7f84d7557e8479f7f086269256f6, type: 2} MistressPreset: {fileID: 11400000, guid: 9aec48759dff81140a8ede5cbefe07d5, type: 2} + boardVersion: 1 stateMachine: {fileID: 259182281} slotLeftTop: {fileID: 687989434} AdminPanel: {fileID: 581100730} diff --git a/Assets/Scripts/GameFSM/ClearFieldState.cs b/Assets/Scripts/GameFSM/ClearFieldState.cs index 4427e0f..3f212d9 100644 --- a/Assets/Scripts/GameFSM/ClearFieldState.cs +++ b/Assets/Scripts/GameFSM/ClearFieldState.cs @@ -60,9 +60,9 @@ public class ClearFieldState : IState private void Explode() { - for (int i = 0; i < FIELD_HEIGHT; i++) + for (int i = 0; i < GameManager.instance.Rows; i++) { - for (int j = 0; j < FIELD_WIDTH; j++) + for (int j = 0; j < GameManager.instance.Cols; j++) { Transform chipTransform = field[i, j]; if (chipTransform != null) @@ -85,8 +85,8 @@ public class ClearFieldState : IState { Object.Destroy(GameManager.instance.currentChip); } - GameManager.fieldModel.makeEmptyField(width: FIELD_WIDTH, height: FIELD_HEIGHT); - GameManager.instance.chipTransforms = new Transform[FIELD_HEIGHT, FIELD_WIDTH]; + GameManager.fieldModel.makeEmptyField(width: GameManager.instance.Cols, height: GameManager.instance.Rows); + GameManager.instance.chipTransforms = new Transform[GameManager.instance.Rows, GameManager.instance.Cols]; } public void update(){ } diff --git a/Assets/Scripts/GameFSM/PositioningState.cs b/Assets/Scripts/GameFSM/PositioningState.cs index d98314d..8608bb9 100644 --- a/Assets/Scripts/GameFSM/PositioningState.cs +++ b/Assets/Scripts/GameFSM/PositioningState.cs @@ -196,7 +196,7 @@ public class PositioningState : IState void CollectValidPositions() { validPositions = new List(); - for (int i = 0; i < 7; i++) + for (int i = 0; i < gm.Cols; i++) { if (GameManager.fieldModel.getHeight(i) != -1) { diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 14ca10e..709fe09 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -324,6 +324,7 @@ public class GameManager : MonoBehaviour #region MAIN + public int Rows = 6, Cols = 7; public PlayerStatsService StatsService; public bool dummyBots = false; public int botsAmount = 5; @@ -443,8 +444,8 @@ public class GameManager : MonoBehaviour Application.targetFrameRate = 60; instance = this; - fieldModel = new FieldModel(7, 6); - chipTransforms = new Transform[6, 7]; + fieldModel = new FieldModel(Cols, Rows); + chipTransforms = new Transform[Rows, Cols]; } diff --git a/Assets/Scripts/Inputs/In.cs b/Assets/Scripts/Inputs/In.cs index 5413600..8670a95 100644 --- a/Assets/Scripts/Inputs/In.cs +++ b/Assets/Scripts/Inputs/In.cs @@ -32,22 +32,22 @@ public class In : MonoBehaviour /// public void Initialize() { - /* source = inputType switch - { - InputSourceType.Keyboard => new KeyboardInput(), - InputSourceType.COM => new COMinput(), - _ => throw new System.NotImplementedException() - };*/ + /* source = inputType switch + { + InputSourceType.Keyboard => new KeyboardInput(), + InputSourceType.COM => new COMinput(), + _ => throw new System.NotImplementedException() + };*/ //ТЕСТЫ -//#if UNITY_EDITOR -// source = new KeyboardInput(); -//#else -// source = new COMinput(); -//#endif - +#if UNITY_EDITOR + source = new KeyboardInput(); +#else source = new COMinput(); +#endif + + //source = new COMinput(); var success = source.Initialize(); diff --git a/Assets/Scripts/Solver.cs b/Assets/Scripts/Solver.cs index 24f725b..6c29fe1 100644 --- a/Assets/Scripts/Solver.cs +++ b/Assets/Scripts/Solver.cs @@ -7,8 +7,8 @@ using UnityEngine; public class Solver { // -------- Параметры/пресет -------- - private const int ROWS = 6; - private const int COLS = 7; + private static int ROWS = 6; + private static int COLS = 7; private static readonly int[] MoveOrder = new[] { 3, 4, 2, 5, 1, 6, 0 }; // центр → края private static readonly int[] CenterWeights = new[] { 3, 4, 5, 7, 5, 4, 3 }; // «полуцентр» тоже ценим @@ -60,6 +60,9 @@ public class Solver // -------- Публичный API -------- public static int FindBestMove(CellState[,] board, CellState currentPlayer) { + ROWS = board.GetLength(0); + COLS = board.GetLength(1); + // сохраняем, за кого сейчас считаем BotPiece = currentPlayer; HumanPiece = (currentPlayer == CellState.Player1) ? CellState.Player2 : CellState.Player1; @@ -326,7 +329,7 @@ public class Solver // -------- Хелперы по ходам/победам -------- private static List GetValidLocations(CellState[,] board) { - var res = new List(7); + var res = new List(COLS); for (int c = 0; c < COLS; c++) if (board[0, c] == CellState.Empty) res.Add(c);