Esempio n. 1
0
    //    int newNumber(int last, int range)
    //    {
    //        int new_r = Random.Range(1, range);
    //        if (last != new_r)
    //        {
    //            return new_r;
    //        }
    //        else
    //        {
    //            return newNumber(last, range);
    //        }
    //    }
    public ohhiSquare[] newGrid(ohhiSquare[] grid)
    {
        int gameIndex = Random.Range (0,ohhiGames.Length); //Get a random but valid gameIndex
        int i = 0;
        foreach (var square in grid) {
            square.isCorrect = false;
            square.state = ohhiGames[gameIndex][0,i];
            if (square.state == 0) {
                square.Playable = true;
            } else {
                square.Playable = false;
            }
            square.correctState = ohhiGames[gameIndex][1,i];
            i++;
        }

        return grid;
    }
Esempio n. 2
0
    void cleanBoard(ohhiSquare[] sqaures)
    {
        foreach (var square in sqaures)
        {

            square.Playable = true;
            square.state = 0;
            square.count = ++counter;
        }
    }