2017년 1월 7일 토요일

How to maintain same index across various lists with random selection?


I posted about similar issue two weeks back. I got some helpful advice that pointed me in the right direction. However, the advice just kind of explained what the problem was and assumed I was good enough of a programmer to figure it out. I am not. 45 hrs later, I am out of time. I will take any help I can get. I've read lots of tutorials. They all dance around the main issue but not the main problem I am having.

What works:
The quiz runs in sequence without problems.
The quiz works when questions are selected randomly but they are not removed from the list.

What doesn't work:
Once randomized and items are removed from the list (to avoid repeating) the answers become wrong.

I have posted the main part of the code which occurs after Next button is pressed. If I could have figured the correct answer, I swear I wouldn't post on it again. My students head home to prepare for exams on Friday and there are tons of other features and information I need to add. If you have time I would really appreciated help in understanding how to make sure my AnswerList keep track of my other Lists (Question,Audio,Hint).


Screen Shot 2016-04-20 at 7.16.37 PM.png 표시 중

--
well. Scott and ABG already gave you some great tips here How do I keep same index # for randomized quiz and answers?
so only can repeat that
Also, since you never remove answers from AnswerList, your indexes get out of sync between your shrinking QuestionList and unshrinking AnswerList.
But if you remove the Answer from the AnswerList at the same time you remove the Question from QuestionList, how will you check it when the Submit button is clicked?
You have to save the current Answer in a separate global variable before removing it, and check the Answer global against the user input when Submit is clicked.

1. so where is that global variable, which holds the correct answer?
2. your before picking event does not make sense, because that item from the list already has been deleted in the button.Next event...


-- 

댓글 없음:

댓글 쓰기