Hi there, guys! I’m making a rubik’s cube game, and there is a timer in it. And it needs to have a random scramble which is in a array (it already has, but it’s not a good one). Look:
public Button botao;
public Sprite imagemStart;
public List<string> Scramble;
public Text textScramble;
public float mil;
public float sec;
public int min;
public void ChangeBool(){
BtnBoolean = !BtnBoolean;
sec = 0;
mil = 0;
min = 0;
textScramble.text = "";
if(!BtnBoolean){
int i = 0;
while(i < 12){
textScramble.text += Scramble[UnityEngine.Random.Range(0, Scramble.Count - 1)].ToString();
i ++;
}
botao.image.overrideSprite = imagemStart;
}
}
It works, but it has some issues like this:
It must not repeat the previous algorithm.
So, my question is: How can I make a random algorithm (R or R’ or R2 or L or L’ or L2, etc) wihtout repeating the previous movement (letter)?
Sorry for my bad english. Please, can someone help me?
