void Spawn(bool skip = false)
    {
        int isSafe = Random.Range(0, 2);

        if (skip)
        {
            isSafe = 1;
        }
        else
        {
            if (isSafe == 0)
            {
                int count = 0;
                for (int i = 1; i < FrogGameQLearning.GetInputCount(); i++)
                {
                    if (indexList[indexList.Count - i] == false)
                    {
                        count++;
                    }
                }

                if (count >= FrogGameQLearning.GetInputCount() - 1)
                {
                    isSafe = 1;
                }
            }
        }

        //isSafe = 1;

        GameObject ne = Instantiate(terrainPrefab, spawner.position, Quaternion.identity, spawner);

        if (isSafe == 1)
        {
            ne.GetComponent <FrogGameTerrain>().Initialize(true, indexList.Count);
            indexList.Add(true);
        }
        else
        {
            ne.GetComponent <FrogGameTerrain>().Initialize(false, indexList.Count);
            indexList.Add(false);
        }

        RefreshTerrain();
    }
    void Start()
    {
        latestIndexTerrain = new int[FrogGameQLearning.GetInputCount()];
        latestIndex        = new bool[FrogGameQLearning.GetInputCount()];

        latestIndexOffset = FrogGameQLearning.GetInputCount();
        //latestIndexOffset = 8;
        //latestIndexOffset = FrogGameQLearning.NUMBER_OF_ACTIONS;

        latestJumpType = 0;
        scoreValue     = 0;
        isGameOver     = false;
        isGameOverPrev = false;
        //

        uiRetry.text = "Retry : " + retryValue.ToString() + " (s)";

        for (int i = 0; i < FrogGameQLearning.GetInputCount() + 10; i++)
        {
            Spawn(true);
        }

        GetLatestIndex();
    }