Reset array after playing the game?

后端 未结 2 1719
夕颜
夕颜 2021-01-24 08:35

I made a quiz in iOS with xcode, what i have now is a quiz that generates 20 random answers out of an array, it controls the text of the labels when a button is pushed to check

相关标签:
2条回答
  • 2021-01-24 08:58

    Either make a copy of arrEurope on game start and restore to it when the game is restarted or use some other array to mark a question as removed. I would personally try to use option 2.

    0 讨论(0)
  • 2021-01-24 09:01

    I see 2 options:

    you call the init line again...

    String *arrEurope[][2] =
    
    {
    
        {@"Eifel.jpg",@"Paris"},
        {@"NotreDame.jpg",@"Paris"},...
    

    Or you add a third row to your array and put the "removed" (i would call it "used") parameter there. In the last case you can then just iterate over your array again and put the "removed" back to "active"

    0 讨论(0)
提交回复
热议问题