fixed bug in 5050 joker

enless loop, if more than 2 answers were  correct
This commit is contained in:
john stone 2011-12-16 20:49:42 +01:00
parent 90272948c5
commit da13020ef7
1 changed files with 19 additions and 7 deletions

12
quiz.js
View File

@ -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',