chip-gameV3/Assets/Scripts/DifficultyPreset.cs
2026-07-14 11:14:13 +03:00

58 lines
2.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "difficulty preset", menuName = "Difficulty Preset", order = 51)]
public class DifficultyPreset : ScriptableObject
{
public string Description;
public int Depth = 6; // как было
public int WinBonus = 1_000_000;
public int RowOfTwoBonus = 100;
public int RowOfThree = 500;
public int CenterBonus = 20;
public int BlockBonus = 5000;
// НОВОЕ — параметры "органичности":
[Range(0, 1f)] public float RandomMoveRate = 0.0f; // с этой вероятностью сделать случайный разумный ход
[Range(0, 1f)] public float MistakeRate = 0.0f; // с этой вероятностью допускаем серьёзную ошибку (например, игнор блока)
public float Temperature = 0.0f; // >0: мягкий выбор по softmax вместо жёсткого максимума
[Range(0f, 1000)] public float ScoreNoiseSigma = 0.0f; // шум к оценке на корне (в очках ф-ии оценивания)
public int TopK = 1; // рассматривать топ-K ходов перед softmax/рандом
public float AvoidLossBanProb = 1.0f; // 0..1 — с какой вероятностью мы ВООБЩЕ отсекаем ходы, ведущие к немедленному проигрышу
public int IMMEDIATE_LOSS_PENALTY = 10000; // штраф, если такой ход всё же в корзине (мягко отталкивает)
#region Дополнительные подсложности
[System.Serializable]
public class AdditionalPreset
{
public DifficultyPreset preset;
public int turns;
}
public List<AdditionalPreset> additionalPresets = new List<AdditionalPreset>();
public DifficultyPreset GetPreset(int movesMade)
{
////доп пресетов нет, берем базовый
//if (additionalPresets.Count == 0)
// return this;
//Доп пресеты есть. Выбираем какой нам надо.
//int turnsCount = 0;
foreach (var presetContainer in additionalPresets)
{
//turnsCount += presetContainer.turns;
if (movesMade <= presetContainer.turns)
return presetContainer.preset;
}
//закончилось действие доп пресетов
return this;
}
#endregion
}