fixed bug in 5050 joker
enless loop, if more than 2 answers were correct
This commit is contained in:
parent
90272948c5
commit
da13020ef7
12
quiz.js
12
quiz.js
|
@ -266,6 +266,17 @@ function takeJoker(activePlayer, joker) {
|
|||
|
||||
if (joker === 'fiftyfifty') {
|
||||
var h1, h2, answers = questions[currentQuestion].answers;
|
||||
var i,rightcount = 0;
|
||||
for (i=0;i<4;i++){
|
||||
if (answers[i].right ) {
|
||||
rightcount++ ;
|
||||
}
|
||||
}
|
||||
if (rightcount >= 3) {
|
||||
$('#answer' + 1).fadeTo(500, 0.1);
|
||||
$('#answer' + 2).fadeTo(500, 0.1);
|
||||
} else {
|
||||
|
||||
do {
|
||||
h1 = Math.floor(Math.random() * 4);
|
||||
h2 = Math.floor(Math.random() * 4);
|
||||
|
@ -273,6 +284,7 @@ function takeJoker(activePlayer, joker) {
|
|||
$('#answer' + h1).fadeTo(500, 0.1);
|
||||
$('#answer' + h2).fadeTo(500, 0.1);
|
||||
}
|
||||
}
|
||||
if (joker === 'nedap') {
|
||||
var q = questions[currentQuestion];
|
||||
sendToBackend({ nedap: { joker: { type: 'nedap',
|
||||
|
|
Loading…
Reference in New Issue