public bool SimulateOnInput()

in Samples~/SampleGame/Assets/Scripts/Simulation.cs [59:104]


    public bool SimulateOnInput(int playerIdx, Chord inputChord)
    {
        _gl.Log.WriteLine("SimulateOnInput()");
        Debug.Assert(inputChord.Keys.Length == BoardColors.Length);
        // test for a match
        bool match = false;
        int matchColor = -1; // don't know yet

        for (int bcNum = 0; bcNum < BoardColors.Length; bcNum++)
        {
            if (inputChord.Keys[bcNum])
            {
                if (matchColor == -1)
                {
                    matchColor = BoardColors[bcNum];
                }
                else
                {
                    if (BoardColors[bcNum] == matchColor)
                    {
                        match = true;
                    }
                    else
                    {
                        match = false;
                        break;
                    }
                }
            }
        }

        if (match)
        {
            // yes, a match!
            for (int bcNum = 0; bcNum < BoardColors.Length; bcNum++)
            {
                if (inputChord.Keys[bcNum])
                {
                    BoardColors[bcNum] = Random.Range(0, 7);
                    Scores[playerIdx]++;
                }
            }
        }

        return match;
    }