// Generated by CoffeeScript 1.9.1 (function() { var A, B, C, aleat, faireQCM, liste, ordre, qA, qB, rB, rC, sol1, trad; aleat = [0, 0, 0]; ordre = [[0, 1, 1, 2], [0, 1, 2, 1], [0, 1, 1, 2], [0, 1, 2, 1], [1, 0, 2, 1], [0, 1, 2, 1]]; qA = ["Tout", "Tout", "Quelque", "Quelque", "Aucun", "Quelque"]; rB = ["est", "est", "est", "est", "n'est", "n'est pas"]; qB = ["tout", "aucun", "tout", "aucun", "tout", "tout"]; rC = ["est", "n'est", "est", "n'est", "est", "est"]; A = ["suspect", "policier", "juge", "avocat", "chauffeur", "majordome", "détective", "greffier"]; B = ["noir", "blanc", "ripou", "bavard", "fumeur", "muet", "gangster", "politicien"]; C = ["gentil", "coupable", "malin", "imbécile", "innocent", "méchant", "escroc", "prisonnier"]; liste = [A, B, C]; sol1 = ["Il n'y a pas de", "Il n'y a que des"]; trad = ["non-", ""]; faireQCM = function() { var exercice; aleat = [Math.floor(Math.random() * 8), Math.floor(Math.random() * 8), Math.floor(Math.random() * 8)]; $(".sB").text(" " + B[aleat[1]] + "s "); $(".sC").text(" " + C[aleat[2]] + "s "); exercice = sol1[Math.floor(Math.random() * 2)] + " "; if (Math.random() > 0.5) { exercice += C[aleat[2]] + "s"; } else { exercice += B[aleat[1]] + "s"; } $("#question").text(exercice); return true; }; $(function() { faireQCM(); $('.jeton').draggable({ snap: false }); return $('.cellule').droppable({ accept: ".jeton", tolerance: "intersect", drop: function(event, ui) { var debut, diagnostic, fin, milieu, textsortie; diagnostic = $(this).attr("id").split("prem")[1]; diagnostic = diagnostic.split("conc"); debut = parseInt(diagnostic[0]); diagnostic = diagnostic[1].split("mid"); milieu = parseInt(diagnostic[1]); fin = parseInt(diagnostic[0]); if (ui.draggable.hasClass('gris')) { if (milieu === 1) { textsortie = "Le dernier jeton code le fait qu'aucun " + trad[fin] + C[aleat[2]] + " n'est " + B[aleat[1]]; } else { textsortie = "Le dernier jeton code le fait que tout " + trad[fin] + C[aleat[2]] + " est " + B[aleat[1]]; } } else { if (debut === 1) { textsortie = "Le dernier jeton code le fait qu'il existe quelqu'un qui n'est pas " + B[aleat[1]]; } else { textsortie = "Le dernier jeton code le fait qu'il existe un " + trad[fin] + C[aleat[2]] + " " + trad[milieu] + B[aleat[1]]; } } $('#sortie').text(textsortie); return true; } }); }); }).call(this);