Esempio n. 1
0
    private void Run()
    {
        var reader    = new CSVReader <TestGachaData>("CSV/gacha_table", true);
        var gachalist = reader.ToList();

        Dictionary <string, float> gachaPerDict = new Dictionary <string, float>();
        Dictionary <string, int>   gachacount   = new Dictionary <string, int>();

        for (var i = 0; i < gachalist.Count; i++)
        {
            gachaPerDict.Add(gachalist[i].Name, gachalist[i].Probability);
            gachacount.Add(gachalist[i].Name, 0);
        }

        Debug.Log(totalCount + "回");
        for (var i = 0; i < totalCount; i++)
        {
            gachacount[ProbabilityCalclator.DetermineFromDict(gachaPerDict)]++;
        }
        string logText = "抽選の精度確認\n試行回数 : " + totalCount.ToString() + "回\n";

        foreach (KeyValuePair <string, float> pair in gachaPerDict)
        {
            logText += pair.Key.ToString() + " 目標 : " + ((pair.Value / 65536f) * 100f).ToString() + "%, 実際 : "
                       + ((gachacount[pair.Key]) / (float)totalCount * 100f).ToString() + "%\n";
        }

        Debug.Log(logText);
    }
Esempio n. 2
0
    /// <summary>
    /// mapの2次元配列初期化
    /// </summary>
    public void SetTileMapData()
    {
        map = new int[mapHeight, mapWidth];
        //各タイルリスト初期化
        redTileList.Clear();
        blueTileList.Clear();
        goldTileList.Clear();
        silverTileList.Clear();
        blackTileList.Clear();
        whiteTileList.Clear();

        for (int i = 0; i < mapHeight; i++)
        {
            for (int j = 0; j < mapWidth; j++)
            {
                if (ProbabilityCalclator.Probability(15))
                {
                    map[i, j] = red;
                }
                else if (ProbabilityCalclator.Probability(15))
                {
                    map[i, j] = blue;
                }
                else if (ProbabilityCalclator.Probability(10))
                {
                    map[i, j] = gold;
                }
                else if (ProbabilityCalclator.Probability(10))
                {
                    map[i, j] = silver;
                }
                else if (ProbabilityCalclator.Probability(5))
                {
                    map[i, j] = black;
                }
                else
                {
                    map[i, j] = normal;
                }
            }
        }

        //white(goal)タイルのランダム設置
        int rndX = Random.Range(0, mapHeight);
        int rndY = Random.Range(0, mapWidth);

        map[rndX, rndY] = white;

        //タイル配置
        CreateMap();
    }