from otree.api import * import time import copy import itertools doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'MR2' players_per_group = None num_rounds = 41 show_up_fee = 0.99 bonus = 99 # time is in minutes time_task = 5 payoff_beliefs = 12.12 # # method returns ids a, b, c etc def ids_out(answers: list): letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] ids = list() for k in range(len(answers)): ids.append(letters[k]) return ids ### Define dict with questions q_dict = dict() # VM is the verbal-math part, trivia is logic-trivia q_dict['trivia'] = dict() q_dict['logic'] = dict() q_dict['math'] = dict() q_dict['verbal'] = dict() for i in range(1, 23): q_dict['trivia'][i], q_dict['logic'][i], q_dict['verbal'][i], q_dict['verbal'][i] = dict(), dict(), dict(), dict() ######################################################################################################################## # trivia questions ######################################################################################################################## q_dict['trivia'][1]['instructions'] = "" q_dict['trivia'][1]['question'] = "Quelle est la durée d’un mandat des membres du Sénat aux États-Unis ?" q_dict['trivia'][1]['answers_vec'] = ["2 ans", "4 ans, comme le mandat du Président", "5 ans", "6 ans", "9 ans"] q_dict['trivia'][1]['solution'] = 'd' q_dict['trivia'][1]['ids_vec'] = ids_out(q_dict['trivia'][1]['answers_vec']) q_dict['trivia'][1]['images'] = 0 q_dict['trivia'][1]['source'] = 'trivia_3, p.21, ex2' q_dict['trivia'][2]['instructions'] = "" q_dict['trivia'][2]['question'] = "En France, sous la Cinquième République, qu’appelle- t-on un ministre d’État ?" q_dict['trivia'][2]['answers_vec'] = ["un ministre ayant son propre portefeuille ministériel", "un secrétaire d’État autonome", "un ministre ayant un portefeuille lié aux fonctions régaliennes", "un ministre ayant 2 portefeuilles ministériels", "un ministre ayant une prééminence protocolaire"] q_dict['trivia'][2]['solution'] = 'e' q_dict['trivia'][2]['ids_vec'] = ids_out(q_dict['trivia'][2]['answers_vec']) q_dict['trivia'][2]['images'] = 0 q_dict['trivia'][2]['source'] = 'trivia_3, p.21, ex3' q_dict['trivia'][3]['instructions'] = "" q_dict['trivia'][3]['question'] = "Qu’est- ce que l’ontogénèse ?" q_dict['trivia'][3]['answers_vec'] = ["l’origine des êtres vivants", "l’étude de l’origine des êtres vivants", "l ’étude du développement d’un être vivant", "l’étude de la généalogie d’une espèce", "ce mot n’existe pas"] q_dict['trivia'][3]['solution'] = 'c' q_dict['trivia'][3]['ids_vec'] = ids_out(q_dict['trivia'][3]['answers_vec']) q_dict['trivia'][3]['images'] = 0 q_dict['trivia'][3]['source'] = 'trivia_3, p.22, ex7' q_dict['trivia'][4]['instructions'] = "" q_dict['trivia'][4]['question'] = "François Jacob a été lauréat du prix Nobel de médecine en 1965. Pour quelle décou verte ?" q_dict['trivia'][4]['answers_vec'] = ["la pénicilline", "l ’eugénisme génétique", "la régulation des cycles cellulaires", "la régulation génétique des enzymes", "les virus cancérogènes"] q_dict['trivia'][4]['solution'] = 'd' q_dict['trivia'][4]['ids_vec'] = ids_out(q_dict['trivia'][4]['answers_vec']) q_dict['trivia'][4]['images'] = 0 q_dict['trivia'][4]['source'] = 'trivia_3, p.23, ex12' q_dict['trivia'][5]['instructions'] = "" q_dict['trivia'][5]['question'] = "Où se trouve le piton de la Four naise ?" q_dict['trivia'][5]['answers_vec'] = ['La Guadeloupe', 'La Guyane', 'L’île Maurice', 'La Martinique', 'La Réunion'] q_dict['trivia'][5]['solution'] = 'e' q_dict['trivia'][5]['ids_vec'] = ids_out(q_dict['trivia'][5]['answers_vec']) q_dict['trivia'][5]['images'] = 0 q_dict['trivia'][5]['source'] = 'trivia_3, p.14, ex1' q_dict['trivia'][6]['instructions'] = "" q_dict['trivia'][6]['question'] = "Où se situe Gandrange ?" q_dict['trivia'][6]['answers_vec'] = ['en Meuse', 'en Nord-Pas-de-Calais', 'en Picardie', 'à Paris', 'en Moselle'] q_dict['trivia'][6]['solution'] = 'c' q_dict['trivia'][6]['ids_vec'] = ids_out(q_dict['trivia'][6]['answers_vec']) q_dict['trivia'][6]['images'] = 0 q_dict['trivia'][6]['source'] = 'trivia_3, p.14, ex2' q_dict['trivia'][6]['instructions'] = "" q_dict['trivia'][6]['question'] = "Valparaiso est une ville" q_dict['trivia'][6]['answers_vec'] = ['de la pointe bretonne', 'de l’extrémité sud du continent africain', 'de l’extrémité sud du continent américain', 'proche de Gibratriviaar', 'du Chili'] q_dict['trivia'][6]['solution'] = 'e' q_dict['trivia'][6]['ids_vec'] = ids_out(q_dict['trivia'][6]['answers_vec']) q_dict['trivia'][6]['images'] = 0 q_dict['trivia'][6]['source'] = 'trivia_3, p.14, ex3' q_dict['trivia'][7]['instructions'] = "" q_dict['trivia'][7]['question'] = "Parmi ces bacilles, lequel n’existe pas ?" q_dict['trivia'][7]['answers_vec'] = ["le bacille d’Arsonval", "le bacille du char bon", "le bacille de Koch", "le bacille de Yersin", "le bacille de Hansen"] q_dict['trivia'][7]['solution'] = 'a' q_dict['trivia'][7]['ids_vec'] = ids_out(q_dict['trivia'][7]['answers_vec']) q_dict['trivia'][7]['images'] = 0 q_dict['trivia'][7]['source'] = 'trivia_4, p.14, ex4' q_dict['trivia'][8]['instructions'] = "" q_dict['trivia'][8]['question'] = "Trouvez l’intrus." q_dict['trivia'][8]['answers_vec'] = ["Deux-Sèvres", "Charente", "Haute-Vienne", "Charente-Maritime", "Vienne"] q_dict['trivia'][8]['solution'] = 'c' q_dict['trivia'][8]['ids_vec'] = ids_out(q_dict['trivia'][8]['answers_vec']) q_dict['trivia'][8]['images'] = 0 q_dict['trivia'][8]['source'] = 'trivia_4, p.14, ex6' q_dict['trivia'][9]['instructions'] = "" q_dict['trivia'][9]['question'] = "Dans le nom de l’indice boursier CAC 40, que signifie CAC ?" q_dict['trivia'][9]['answers_vec'] = ["calcul des actions comptables", "crédit d’actifs comptables", "cotation actionnariat créance", "cotation assistée en continu", "cote des actions capitalisées"] q_dict['trivia'][9]['solution'] = 'e' q_dict['trivia'][9]['ids_vec'] = ids_out(q_dict['trivia'][9]['answers_vec']) q_dict['trivia'][9]['images'] = 0 q_dict['trivia'][9]['source'] = 'trivia_4, p.15, ex8' q_dict['trivia'][10]['instructions'] = "" q_dict['trivia'][10]['question'] = "À quel auteur doit- on Vie de Rancé ?" q_dict['trivia'][10]['answers_vec'] = ["Châteaubriant", "Chateaubriand", "France", "Allais", "Barjavel"] q_dict['trivia'][10]['solution'] = 'b' q_dict['trivia'][10]['ids_vec'] = ids_out(q_dict['trivia'][10]['answers_vec']) q_dict['trivia'][10]['images'] = 0 q_dict['trivia'][10]['source'] = 'trivia_4, p.15, ex9' q_dict['trivia'][11]['instructions'] = "" q_dict['trivia'][11]['question'] = "Quel ouvrage commence par la phrase sui vante : « Aujourd’hui maman est morte. Ou peut- être hier, je ne sais pas. »" q_dict['trivia'][11]['answers_vec'] = [" Vipère au poing d’Hervé Bazin", ' Le châ teau de ma mère de Marcel Pagnol', ' Sodome et Gomorrhe de Marcel Proust', ' Au bon heur des dames d’Émile Zola', ' L’étranger d’Albert Camus'] q_dict['trivia'][11]['solution'] = 'e' q_dict['trivia'][11]['ids_vec'] = ids_out(q_dict['trivia'][11]['answers_vec']) q_dict['trivia'][11]['images'] = 0 q_dict['trivia'][11]['source'] = 'trivia_4, p.15, ex10' q_dict['trivia'][12]['instructions'] = "" q_dict['trivia'][12]['question'] = "Quel ouvrage commence par la phrase sui vante : « Aujourd’hui maman est morte. Ou peut- être hier, je ne sais pas. »" q_dict['trivia'][12]['answers_vec'] = [" Vipère au poing d’Hervé Bazin", ' Le châ teau de ma mère de Marcel Pagnol', ' Sodome et Gomorrhe de Marcel Proust', ' Au bon heur des dames d’Émile Zola', ' L’étranger d’Albert Camus'] q_dict['trivia'][12]['solution'] = 'a' q_dict['trivia'][12]['ids_vec'] = ids_out(q_dict['trivia'][12]['answers_vec']) q_dict['trivia'][12]['images'] = 0 q_dict['trivia'][12]['source'] = 'trivia_4, p.15, ex12' q_dict['trivia'][13]['instructions'] = "" q_dict['trivia'][13]['question'] = "À quel personnage historique attribue-t-on cette phrase: J’y suis, j’y reste ! " q_dict['trivia'][13]['answers_vec'] = ['Patrice de Mac-Mahon', 'François Mitterrand', 'Pierre Cambronne', 'Albert Lebrun', 'Napoléon 1er '] q_dict['trivia'][13]['solution'] = 'b' q_dict['trivia'][13]['ids_vec'] = ids_out(q_dict['trivia'][13]['answers_vec']) q_dict['trivia'][13]['images'] = 0 q_dict['trivia'][13]['source'] = 'trivia_4, p.15, ex13' q_dict['trivia'][14]['instructions'] = "" q_dict['trivia'][14]['question'] = "Combien d’articles compte la Déclaration des droits de l’homme et du citoyen de 1789 ?" q_dict['trivia'][14]['answers_vec'] = ['500', '1 seul', '10', '12', '17'] q_dict['trivia'][14]['solution'] = 'e' q_dict['trivia'][14]['ids_vec'] = ids_out(q_dict['trivia'][14]['answers_vec']) q_dict['trivia'][14]['images'] = 0 q_dict['trivia'][14]['source'] = 'trivia_4, p.16, ex17' q_dict['trivia'][15]['instructions'] = "" q_dict['trivia'][15]['question'] = "Parmi ces tra vaux d’Hercule, trouvez l’intrus." q_dict['trivia'][15]['answers_vec'] = ['Tuer l’Hydre de Lerne.', 'Nettoyer les écuries d’Augias.', 'Libérer Eurydice et Orphée des Enfers.', 'Dompter les cavales de Diomède.', 'Abattre les oiseaux du lac Stymphale.'] q_dict['trivia'][15]['solution'] = 'c' q_dict['trivia'][15]['ids_vec'] = ids_out(q_dict['trivia'][15]['answers_vec']) q_dict['trivia'][15]['images'] = 0 q_dict['trivia'][15]['source'] = 'trivia_4, p.16, ex19' q_dict['trivia'][16]['instructions'] = "" q_dict['trivia'][16]['question'] = "Où se situerait actuellement la Carthage de l’Antiquité ? " q_dict['trivia'][16]['answers_vec'] = ['en Grèce', 'en Tunisie', 'en Turquie', 'en Égypte', 'en Libye'] q_dict['trivia'][16]['solution'] = 'b' q_dict['trivia'][16]['ids_vec'] = ids_out(q_dict['trivia'][16]['answers_vec']) q_dict['trivia'][16]['images'] = 0 q_dict['trivia'][16]['source'] = 'trivia_4, p.17, ex24' q_dict['trivia'][17]['instructions'] = "" q_dict['trivia'][17]['question'] = "Qui sont les deux présidents de la Cinquième République française ?" q_dict['trivia'][17]['answers_vec'] = ["Félix Faure et Gaston Doumergue", "Vincent Auriol et René Coty", "Charles de Gaulle et Georges Pompidou", "Félix Faure et René Coty", "Charles de Gaulle et Gaston Doumergue"] q_dict['trivia'][17]['solution'] = 'b' q_dict['trivia'][17]['ids_vec'] = ids_out(q_dict['trivia'][17]['answers_vec']) q_dict['trivia'][17]['images'] = 0 q_dict['trivia'][17]['source'] = 'trivia_4, p.17, ex25' q_dict['trivia'][18]['instructions'] = "" q_dict['trivia'][18]['question'] = "Le mas sacre de la Saint- Barthélemy a eu lieu en 1572, sous le règne de:" q_dict['trivia'][18]['answers_vec'] = ['Henri III', 'Henri IV', 'François II', 'Charles IX', 'Louis XIII'] q_dict['trivia'][18]['solution'] = 'd' q_dict['trivia'][18]['ids_vec'] = ids_out(q_dict['trivia'][18]['answers_vec']) q_dict['trivia'][18]['images'] = 0 q_dict['trivia'][18]['source'] = 'trivia_4, p.17, ex26' q_dict['trivia'][19]['instructions'] = "" q_dict['trivia'][19]['question'] = "Le Conseil de sécurité des Nations unies comprend:" q_dict['trivia'][19]['answers_vec'] = ['5 pays membres permanents', '3 pays membres permanents', '4 pays membres permanents', '7 pays membres permanents', 'aucun pays membre permanent'] q_dict['trivia'][19]['solution'] = 'a' q_dict['trivia'][19]['ids_vec'] = ids_out(q_dict['trivia'][19]['answers_vec']) q_dict['trivia'][19]['images'] = 0 q_dict['trivia'][19]['source'] = 'trivia_4, p.17, ex27' q_dict['trivia'][20]['instructions'] = "" q_dict['trivia'][20]['question'] = "Combien existe- t-il de grands chelems dans le tennis professionnel ?" q_dict['trivia'][20]['answers_vec'] = ['2', '3', '4', '5', '6'] q_dict['trivia'][20]['solution'] = 'c' q_dict['trivia'][20]['ids_vec'] = ids_out(q_dict['trivia'][20]['answers_vec']) q_dict['trivia'][20]['images'] = 0 q_dict['trivia'][20]['source'] = 'trivia_4, p.17, ex28' q_dict['trivia'][21]['instructions'] = "" q_dict['trivia'][21]['question'] = "Quel signe astrologique se situe entre le 22 décembre et le 20 janvier ? " q_dict['trivia'][21]['answers_vec'] = ['verseau', 'sagittaire', 'capricorne', 'scorpion', 'lion'] q_dict['trivia'][21]['solution'] = 'c' q_dict['trivia'][21]['ids_vec'] = ids_out(q_dict['trivia'][21]['answers_vec']) q_dict['trivia'][21]['images'] = 0 q_dict['trivia'][21]['source'] = 'trivia_4, p.17, ex29' q_dict['trivia'][22]['instructions'] = "" q_dict['trivia'][22]['question'] = "Dans quelle ville a eu lieu le festival international du film policier jus qu’en 2007 ? " q_dict['trivia'][22]['answers_vec'] = ['Angoulême', 'Deauville', 'Cannes', 'Avignon', 'Cognac'] q_dict['trivia'][22]['solution'] = 'e' q_dict['trivia'][22]['ids_vec'] = ids_out(q_dict['trivia'][22]['answers_vec']) q_dict['trivia'][22]['images'] = 0 q_dict['trivia'][22]['source'] = 'trivia_4, p.17, ex30' for i in range(1, 23): q_dict['trivia'][i]['width'] = '' q_dict['trivia'][i]['grammar'] = 0 order_vm = [['math', 6], ['verbal', 2], ['verbal', 12], ['verbal', 5], ['verbal', 1], ['verbal', 15], ['verbal', 20], ['math', 4], ['verbal', 13], ['math', 20], ['math', 1], ['math', 17], ['math', 8], ['verbal', 6], ['verbal', 17], ['verbal', 3], ['math', 12], ['verbal', 19], ['math', 18], ['verbal', 11], ['math', 19], ['verbal', 16], ['verbal', 8], ['math', 14], ['verbal', 14], ['math', 2], ['math', 15], ['math', 16], ['math', 13], ['verbal', 10], ['math', 7], ['math', 11], ['verbal', 7], ['verbal', 4], ['math', 10], ['verbal', 18], ['math', 3], ['math', 5], ['math', 9], ['verbal', 9]] order_lt = [['logic', 4], ['logic', 9], ['trivia', 8], ['trivia', 13], ['trivia', 6], ['logic', 2], ['trivia', 17], ['trivia', 1], ['logic', 1], ['logic', 5], ['logic', 8], ['logic', 14], ['logic', 18], ['logic', 6], ['trivia', 4], ['logic', 3], ['trivia', 9], ['trivia', 2], ['logic', 11], ['trivia', 15], ['logic', 13], ['logic', 10], ['trivia', 3], ['trivia', 20], ['logic', 7], ['logic', 12], ['trivia', 19], ['trivia', 16], ['trivia', 11], ['logic', 17], ['trivia', 5], ['logic', 16], ['logic', 20], ['trivia', 12], ['trivia', 7], ['trivia', 18], ['trivia', 10], ['logic', 15], ['trivia', 14], ['logic', 19]] order_vm_reverse = list() order_lt_reverse = list() for i in range(1, 41): order_vm_reverse.append(order_vm[40 - i]) order_lt_reverse.append(order_lt[40 - i]) ######################################################################################################################## # Logic questions ######################################################################################################################## # # first set of questions # len_vec_1 = [5, 3, 4, 3, 4, 4, 3, 4, 4, 4] # solutions_vec_1 = ['d', 'b', 'c', 'b', 'd', 'b', 'c', 'a', 'c', 'd'] # # second set of questions. # len_vec_2 = [8, 8, 8, 8, 8, 8, 8, 8] # solutions_vec_2 = ['a', 'c', 'd', 'c', 'c', 'f', 'b', 'f'] # below I just put it all together into one vector # # third set of questions. # len_vec_2 = [6, 6, 6, 6, 6, 5, 6] # solutions_vec_2 = ['b', 'a', 'b', 'f', 'f', 'c', 'b'] len_vec = [5, 3, 4, 3, 4, 4, 3, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6] solutions_vec = ['d', 'b', 'c', 'b', 'd', 'b', 'c', 'a', 'c', 'd', 'a', 'c', 'd', 'c', 'c', 'f', 'b', 'f', 'b', 'a', 'b', 'f', 'f', 'c', 'b'] for l in range(1, len(len_vec)+1): q_dict['logic'][l] = dict() question = "Images/" + str(l) + "q.PNG" answers_vec = list() length = len_vec[l-1] for x in ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'][0:length]: answers_vec.append("Images/" + str(l) + x + ".PNG") q_dict['logic'][l]['question'] = question q_dict['logic'][l]['answers_vec'] = answers_vec q_dict['logic'][l]['solution'] = solutions_vec[l-1] q_dict['logic'][l]['ids_vec'] = ids_out(q_dict['logic'][l]['answers_vec']) q_dict['logic'][l]['images'] = 1 for l in range(1, 7): q_dict['logic'][l]['source'] = 'tests_vocab_grammar_math, p.22-, ex' + str(l) q_dict['logic'][l]['width'] = '60%' q_dict['logic'][l]['instructions'] = "Quelle figure s’inscrit logiquement?" for l in range(7, 11): q_dict['logic'][l]['source'] = 'tests_vocab_grammar_math, p.22-, ex' + str(l-1) q_dict['logic'][l]['width'] = '60%' q_dict['logic'][l]['instructions'] = "Quelle figure s’inscrit logiquement?" for l in range(11, 19): q_dict['logic'][l]['source'] = 'tests_logique, p.83-, ex' + str(l - 1) q_dict['logic'][l]['width'] = '30%' q_dict['logic'][l]['instructions'] = "Trouvez la case qui complète logiquement la matrice." ex_vec = [1, 4, 5, 6, 9, 10, 11] instr1 = "Trouvez l'intrus." instr2 = "Quelle figure s’intègre logiquement dans l’ensemble ?" instr_vec = [instr1, instr1, instr2, instr1, instr1, instr1, instr2] c = 0 for l in range(19, 26): q_dict['logic'][l]['source'] = 'tests_logique, p.83-, ex' + str(ex_vec[c]) q_dict['logic'][l]['width'] = '80%' q_dict['logic'][l]['instructions'] = instr_vec[c] c += 1 for l in range(1, 26): q_dict['logic'][l]['grammar'] = 0 ######################################################################################################################## # Math questions ######################################################################################################################## for i in range(1, 21): q_dict['math'][i] = dict() q_dict['math'][i]['width'] = '' q_dict['math'][1]['instructions'] = "" q_dict['math'][1]['question'] = "David dispose d’un capital de 15000 euros. Il décide d’en placer les deux tiers sur un livret A, et de ne pas toucher au tiers restant. Après avoir retiré son investissement accompagné des intérêts au bout de deux ans, il dispose de 17100 euros de capital au total. Quelle est le taux d’intérêt annuel du livret A ?" q_dict['math'][1]['answers_vec'] = ['7%', '9%', '10%', "11%", "13%"] q_dict['math'][1]['solution'] = 'c' q_dict['math'][1]['ids_vec'] = ids_out(q_dict['math'][1]['answers_vec']) q_dict['math'][1]['images'] = 0 q_dict['math'][1]['source'] = 'test_logic_math.pdf, p.10ff, q1' q_dict['math'][2]['instructions'] = "" q_dict['math'][2]['question'] = "Marc entoure d’une clôture sa piscine de forme carrée. L’écart entre la clôture et les rebords de la piscine est de trois mètres tout autour de la piscine. Sachant que l’aire de la clôture est de cent soixante-neuf mètre carrés, quelle est l’aire de la piscine ?" q_dict['math'][2]['answers_vec'] = ['16m²', '49m²', '81m²', '100m²', '121m²'] q_dict['math'][2]['solution'] = 'b' q_dict['math'][2]['ids_vec'] = ids_out(q_dict['math'][2]['answers_vec']) q_dict['math'][2]['images'] = 0 q_dict['math'][2]['source'] = 'test_logic_math.pdf, p.10ff, q2' q_dict['math'][3]['instructions'] = "" q_dict['math'][3]['question'] = "Un groupe d’étudiants décide d’acheter un cadeau d’anniversaire à leur ami. Cela leur coûtera 44 euros chacun. Cependant, si deux d’entre eux décide de ne pas payer, cela coutera 52 euros aux payeurs. Combien coûte le cadeau ?" q_dict['math'][3]['answers_vec'] = ['410', '468', '518', '572', '614'] q_dict['math'][3]['solution'] = 'd' q_dict['math'][3]['ids_vec'] = ids_out(q_dict['math'][3]['answers_vec']) q_dict['math'][3]['images'] = 0 q_dict['math'][3]['source'] = 'test_logic_math.pdf, p.10ff, q3' q_dict['math'][4]['instructions'] = "" q_dict['math'][4]['question'] = "Seul un de ces nombres est la somme de trois nombres premiers compris entre 5 et 80. Lequel?" q_dict['math'][4]['answers_vec'] = ['199', '208', '224', '246', '283'] q_dict['math'][4]['solution'] = 'a' q_dict['math'][4]['ids_vec'] = ids_out(q_dict['math'][4]['answers_vec']) q_dict['math'][4]['images'] = 0 q_dict['math'][4]['source'] = 'test_logic_math.pdf, p.10ff, q4' q_dict['math'][5]['instructions'] = "" q_dict['math'][5]['question'] = "Que représente 16 par rapport à 128 ?" q_dict['math'][5]['answers_vec'] = ['16% ', '1.25%', '2/16', '13%', '¼'] q_dict['math'][5]['solution'] = 'c' q_dict['math'][5]['ids_vec'] = ids_out(q_dict['math'][5]['answers_vec']) q_dict['math'][5]['images'] = 0 q_dict['math'][5]['source'] = 'test_logic_math.pdf, p.10ff, q6' q_dict['math'][6]['instructions'] = "" q_dict['math'][6]['question'] = "En une minute, la photocopieuse de Marc imprime vingt-quatre exemplaires d’une même page. Marc doit imprimer cinq cent quatre exemplaires d’un prospectus. Combien de temps cela lui prendra-t-il ?" q_dict['math'][6]['answers_vec'] = ['18min40s', '19min30s', '20min20s', '21min', '22min10s'] q_dict['math'][6]['solution'] = 'd' q_dict['math'][6]['ids_vec'] = ids_out(q_dict['math'][6]['answers_vec']) q_dict['math'][6]['images'] = 0 q_dict['math'][6]['source'] = 'test_logic_math.pdf, p.10ff, q7' q_dict['math'][7]['instructions'] = "" q_dict['math'][7]['question'] = "Dans le cadre d’une course à pied, un circuit de six kilomètres a été créé. Il est délimité par un grand plot de marquage à l’entrée, un autre à la sortie puis un tous les deux cent cinquante mètres du circuit. Combien de plots compte-t-on sur ce parcours ?" q_dict['math'][7]['answers_vec'] = ['22', '23', '24', '25', '26'] q_dict['math'][7]['solution'] = 'd' q_dict['math'][7]['ids_vec'] = ids_out(q_dict['math'][7]['answers_vec']) q_dict['math'][7]['images'] = 0 q_dict['math'][7]['source'] = 'test_logic_math.pdf, p.10ff, q8' q_dict['math'][8]['instructions'] = "" q_dict['math'][8]['question'] = "On considère six entiers consécutifs. La somme des trois premiers est égale à la moitié de la somme des trois derniers. Que vaut la somme de ces six entiers ?" q_dict['math'][8]['answers_vec'] = ['27', '33', '39', '45', '51'] q_dict['math'][8]['solution'] = 'a' q_dict['math'][8]['ids_vec'] = ids_out(q_dict['math'][8]['answers_vec']) q_dict['math'][8]['images'] = 0 q_dict['math'][8]['source'] = 'test_logic_math.pdf, p.10ff, q9' q_dict['math'][9]['instructions'] = "" q_dict['math'][9]['question'] = "Dans une papeterie, la moitié des stylos vendus sont des stylos bleus, le tiers des stylos noirs, le neuvième des stylos rouges et le reste sont des stylos verts. Le mois dernier, 25 stylos verts ont été vendus. Combien de stylos ont été vendus le mois dernier ?" q_dict['math'][9]['answers_vec'] = ['320', '385', '410', '450', '505'] q_dict['math'][9]['solution'] = 'd' q_dict['math'][9]['ids_vec'] = ids_out(q_dict['math'][9]['answers_vec']) q_dict['math'][9]['images'] = 0 q_dict['math'][9]['source'] = 'test_logic_math.pdf, p.10ff, q10' q_dict['math'][10]['instructions'] = "" q_dict['math'][10]['question'] = "Combien y a-t-il de multiples de 9 entre -308 et 148 ?" q_dict['math'][10]['answers_vec'] = ['47', '48', '49', '50', '51'] q_dict['math'][10]['solution'] = 'e' q_dict['math'][10]['ids_vec'] = ids_out(q_dict['math'][10]['answers_vec']) q_dict['math'][10]['images'] = 0 q_dict['math'][10]['source'] = 'test_logic_math.pdf, p.10ff, q11' q_dict['math'][11]['instructions'] = "" q_dict['math'][11]['question'] = "Que vaut 18 ÷ 0.02 ?" q_dict['math'][11]['answers_vec'] = ['36 x 25', '9 ÷ 0.04', '1.8 x 20', '450', '(18÷2) ÷100'] q_dict['math'][11]['solution'] = 'a' q_dict['math'][11]['ids_vec'] = ids_out(q_dict['math'][11]['answers_vec']) q_dict['math'][11]['images'] = 0 q_dict['math'][11]['source'] = 'test_logic_math.pdf, p.10ff, q13' q_dict['math'][12]['instructions'] = "" q_dict['math'][12]['question'] = "Depuis son ouverture en 2003, le lycée « Sharpe » a vu son nombre d’étudiants tripler chaque année jusqu’en 2006, puis doubler chaque année jusqu’en 2008. Combien d’étudiants compte le lycée à la rentrée 2008, s’il comptait 8 étudiants l’année de son ouverture ?" q_dict['math'][12]['answers_vec'] = ['432', '642', '782', '864', '1728'] q_dict['math'][12]['solution'] = 'd' q_dict['math'][12]['ids_vec'] = ids_out(q_dict['math'][12]['answers_vec']) q_dict['math'][12]['images'] = 0 q_dict['math'][12]['source'] = 'test_logic_math.pdf, p.10ff, q14' q_dict['math'][13]['instructions'] = "" q_dict['math'][13]['question'] = "Dans une classe de seconde, on compte deux fois plus de garçons que de filles. Sachant que la moyenne des filles est de quinze, et que la moyenne de la classe est de onze, quelle est la moyenne des " q_dict['math'][13]['answers_vec'] = ['3', '5', '7', '9', 'Impossible à déterminer !'] q_dict['math'][13]['solution'] = 'd' q_dict['math'][13]['ids_vec'] = ids_out(q_dict['math'][13]['answers_vec']) q_dict['math'][13]['images'] = 0 q_dict['math'][13]['source'] = 'test_logic_math.pdf, p.10ff, q15' q_dict['math'][14]['instructions'] = "" q_dict['math'][14]['question'] ='Marie veut repeindre les murs de sa chambre et demande à sa sœur Julie de l’aider. La pièce (rectangulaire) fait 3 m de large et 5 m de long. Le plafond est à une hauteur de 2,50 m. Avant d’aller acheter leur peinture, Marie et Julie doivent déterminer la surface qu’elles auront à peindre. Bricoleuses amateurs, elles décident de prévoir large en considérant que les murs sont entiers, c’est-à-dire sans fenêtre et sans porte. Mais, Marie et Julie ne sont pas très à l’aise avec l’arithmétique : elles ont besoin de votre aide pour le calcul de la surface. Selon vous, quelle surface devront-elles peindre ?' q_dict['math'][14]['answers_vec'] = ['35 m²', '40 m²', '37,5 m²', '42,5 m²'] q_dict['math'][14]['solution'] = 'b' q_dict['math'][14]['ids_vec'] = ids_out(q_dict['math'][14]['answers_vec']) q_dict['math'][14]['images'] = 0 q_dict['math'][14]['source'] = 'Test_de_Logique, p.9 ff, ex23' q_dict['math'][15]['instructions'] = '' q_dict['math'][15]['question'] ='Quel est le résultat de l’opération suivante : 2 + 10 ×5 – 14 : 2 + 5 – 6 ×2 = ? ' q_dict['math'][15]['answers_vec'] = ['38', '40', '42', '36'] q_dict['math'][15]['solution'] = 'a' q_dict['math'][15]['ids_vec'] = ids_out(q_dict['math'][15]['answers_vec']) q_dict['math'][15]['images'] = 0 q_dict['math'][15]['source'] = 'Test_de_Logique, p.9 ff, ex24' q_dict['math'][15]['width'] = '40%' q_dict['math'][16]['instructions'] = "" q_dict['math'][16]['question'] = "Henri, Pierre, Paul et Michel assistent à un accident routier : une citerne, de 10 m de long et 2 m de haut s’est renversée sur la route. Cette citerne, pleine de vin, perd tout son contenu sur la route. Face à ce gâchis, une discussion s’engage entre les quatre amis pour savoir combien de bouteilles de vin cette perte représente. Selon Henri, il en faudrait près de 10 000. Pour Pierre, c’est beaucoup trop: 5 000 bouteilles suffiraient. Paul pense que ce n’est vraiment pas assez : selon lui, il en faudrait 20 000. Michel, quant à lui, estime que 30 000 bouteilles seraient nécessaires. Sachant qu’une bouteille peut contenir 1 litre de vin, lequel, selon vous, est le plus proche de la vérité ?" q_dict['math'][16]['answers_vec'] = ['Henri (10 000)', 'Pierre (5 000)', 'Paul (20 000)', 'Michel (30 000)'] q_dict['math'][16]['solution'] = 'd' q_dict['math'][16]['ids_vec'] = ids_out(q_dict['math'][16]['answers_vec']) q_dict['math'][16]['images'] = 0 q_dict['math'][16]['source'] = 'Test_de_Logique, p.9 ff, ex25' q_dict['math'][17]['instructions'] ="Quel est le résultat de l’opération suivante :" q_dict['math'][17]['question'] = "Images/m1q.PNG" q_dict['math'][17]['answers_vec'] = ["Images/m1a.PNG", "Images/m1b.PNG", "Images/m1c.PNG", "Images/m1d.PNG"] q_dict['math'][17]['solution'] = 'd' q_dict['math'][17]['ids_vec'] = ids_out(q_dict['math'][17]['answers_vec']) q_dict['math'][17]['images'] = 1 q_dict['math'][17]['source'] = 'Test_de_Logique, p.9 ff, ex26' q_dict['math'][18]['instructions'] = "" q_dict['math'][18]['question'] = "Un chef d’entreprise, dont la société emploie 100 cadres et 900 ouvriers, veut savoir combien il doit recruter de nouveaux employés dans le cadre de la réduction du temps de travail. Son personnel travaillait auparavant 39 heures par semaine ; il va désormais travailler 35 heures. Combien faut-il embaucher de cadres et d’ouvriers pour compenser intégralement les heures non faites ? " q_dict['math'][18]['answers_vec'] = ['11 cadres et 103 ouvriers', '18 cadres et 124 ouvriers', '10 cadres et 134 ouvriers', '22 cadres et 120 ouvriers' ] q_dict['math'][18]['solution'] = 'a' q_dict['math'][18]['ids_vec'] = ids_out(q_dict['math'][18]['answers_vec']) q_dict['math'][18]['images'] = 0 q_dict['math'][18]['source'] = 'Test_de_Logique, p.9 ff, ex27' q_dict['math'][19]['instructions'] = "" q_dict['math'][19]['question'] = "Une entreprise effectue des travaux de réfection dans votre habitation principale, construite il y a plus deux ans. Grâce à une nouvelle loi, ces travaux ne sont plus soumis à une TVA de 19,6 % mais une TVA de 5,5 %. Quel est votre gain pour des travaux d’un coût hors taxes de 5 000 €." q_dict['math'][19]['answers_vec'] = ['605 €', '655 €', '705 €', '755 €'] q_dict['math'][19]['solution'] = 'c' q_dict['math'][19]['ids_vec'] = ids_out(q_dict['math'][19]['answers_vec']) q_dict['math'][19]['images'] = 0 q_dict['math'][19]['source'] = 'Test_de_Logique, p.9 ff, ex29' q_dict['math'][20]['instructions'] = "" q_dict['math'][20]['question'] = "Vous vous rendez dîner chez un ami et c’est à vous que revient la conception du dessert. Vous connaissez une merveilleuse recette de gâteau au chocolat. Pour 6 personnes, les ingrédients sont : 250 g de beurre, 200 g de sucre, 300 g de chocolat, 6 œufs et 3 cuillerées de farine. Mais, votre ami reçoit 4 personnes seulement. Quelles sont, dans ce cas, les doses requises pour chaque ingrédient de la recette ?" q_dict['math'][20]['answers_vec'] = ['170 g de beurre, 130 g de sucre, 200 g de chocolat, 4 œufs, 2 cuillerées de farine', '200 g de beurre, 150 g de sucre, 240 g de chocolat, 4 œufs, 1 cuillerée de farine','230 g de beurre, 100 g de sucre, 180 g de chocolat, 5 œufs, 2 cuillerées de farine', '190 g de beurre, 110 g de sucre, 250 g de chocolat, 3 œufs, 1 cuillerée de farine'] q_dict['math'][20]['solution'] = 'a' q_dict['math'][20]['ids_vec'] = ids_out(q_dict['math'][20]['answers_vec']) q_dict['math'][20]['images'] = 0 q_dict['math'][20]['source'] = 'Test_de_Logique, p.9 ff, ex30' for l in range(1, 21): q_dict['math'][l]['grammar'] = 0 ######################################################################################################################## # Math questions ######################################################################################################################## for i in range(1, 26): q_dict['verbal'][i] = dict() q_dict['verbal'][i]['width'] = '' q_dict['verbal'][1]['instructions'] = "" q_dict['verbal'][1]['question'] = "Repérez le mot bien orthographié." q_dict['verbal'][1]['answers_vec'] = ['Antiloppe', 'Saponaire', 'Crusifére', "Itallique"] q_dict['verbal'][1]['solution'] = 'b' q_dict['verbal'][1]['ids_vec'] = ids_out(q_dict['verbal'][1]['answers_vec']) q_dict['verbal'][1]['images'] = 0 q_dict['verbal'][1]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.1' q_dict['verbal'][2]['instructions'] = "" q_dict['verbal'][2]['question'] = "Repérez le mot bien orthographié." q_dict['verbal'][2]['answers_vec'] = ['Grimmer', 'Conlédon', 'Blate', 'Ouvroir'] q_dict['verbal'][2]['solution'] = 'd' q_dict['verbal'][2]['ids_vec'] = ids_out(q_dict['verbal'][2]['answers_vec']) q_dict['verbal'][2]['images'] = 0 q_dict['verbal'][2]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.2' q_dict['verbal'][3]['instructions'] = "" q_dict['verbal'][3]['question'] = "Repérez le mot bien orthographié." q_dict['verbal'][3]['answers_vec'] = ['Inepsie', 'Dolant', 'Blastula', 'Cadduque'] q_dict['verbal'][3]['solution'] = 'c' q_dict['verbal'][3]['ids_vec'] = ids_out(q_dict['verbal'][3]['answers_vec']) q_dict['verbal'][3]['images'] = 0 q_dict['verbal'][3]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.3' q_dict['verbal'][4]['instructions'] = "" q_dict['verbal'][4]['question'] = "Repérez le mot bien orthographié." q_dict['verbal'][4]['answers_vec'] = ['Excès', 'Chovin', 'Bipace', 'Amilose'] q_dict['verbal'][4]['solution'] = 'a' q_dict['verbal'][4]['ids_vec'] = ids_out(q_dict['verbal'][4]['answers_vec']) q_dict['verbal'][4]['images'] = 0 q_dict['verbal'][4]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.4' q_dict['verbal'][5]['instructions'] = "" q_dict['verbal'][5]['question'] = "Repérez le mot bien orthographié." q_dict['verbal'][5]['answers_vec'] = ['Polluer', 'Cretone', 'Afecter', 'Naga'] q_dict['verbal'][5]['solution'] = 'a' q_dict['verbal'][5]['ids_vec'] = ids_out(q_dict['verbal'][5]['answers_vec']) q_dict['verbal'][5]['images'] = 0 q_dict['verbal'][5]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.5' q_dict['verbal'][6]['instructions'] = "" q_dict['verbal'][6]['question'] = "Repérez le mot bien orthographié." q_dict['verbal'][6]['answers_vec'] = ['Chaume', 'Maculla', 'Nassiller', 'Margele'] q_dict['verbal'][6]['solution'] = 'a' q_dict['verbal'][6]['ids_vec'] = ids_out(q_dict['verbal'][6]['answers_vec']) q_dict['verbal'][6]['images'] = 0 q_dict['verbal'][6]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.6' q_dict['verbal'][7]['instructions'] = "" q_dict['verbal'][7]['question'] = "Repérez le mot bien orthographié. " q_dict['verbal'][7]['answers_vec'] = ['Stirène', 'Picadorre', 'Marelle', 'Massete'] q_dict['verbal'][7]['solution'] = 'c' q_dict['verbal'][7]['ids_vec'] = ids_out(q_dict['verbal'][7]['answers_vec']) q_dict['verbal'][7]['images'] = 0 q_dict['verbal'][7]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.7' q_dict['verbal'][8]['instructions'] = "" q_dict['verbal'][8]['question'] = "Repérez le mot bien orthographié." q_dict['verbal'][8]['answers_vec'] = ['Ovère', 'Anachorète', 'Stuck', 'Kamikase'] q_dict['verbal'][8]['solution'] = 'b' q_dict['verbal'][8]['ids_vec'] = ids_out(q_dict['verbal'][8]['answers_vec']) q_dict['verbal'][8]['images'] = 0 q_dict['verbal'][8]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.8' q_dict['verbal'][9]['instructions'] = "" q_dict['verbal'][9]['question'] = "Repérez le mot bien orthographié." q_dict['verbal'][9]['answers_vec'] = ['Phisiologie', 'Poncif', 'Martiné', 'Kaqui'] q_dict['verbal'][9]['solution'] = 'b' q_dict['verbal'][9]['ids_vec'] = ids_out(q_dict['verbal'][9]['answers_vec']) q_dict['verbal'][9]['images'] = 0 q_dict['verbal'][9]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.9' q_dict['verbal'][10]['instructions'] = "" q_dict['verbal'][10]['question'] = "Repérez le mot bien orthographié." q_dict['verbal'][10]['answers_vec'] = ['Picqules', 'Saizine', 'Style', 'Mistère'] q_dict['verbal'][10]['solution'] = 'c' q_dict['verbal'][10]['ids_vec'] = ids_out(q_dict['verbal'][10]['answers_vec']) q_dict['verbal'][10]['images'] = 0 q_dict['verbal'][10]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.10' ##############these questions are displayed in a slightly different format q_dict['verbal'][11]['instructions'] = "" q_dict['verbal'][11]['question'] = 'Les phrases ci-dessous ont ete déposés en promotions a, b, c, d. Repérez dans quelle partie de la phrase se trouve la faute et indiquez-le. Pour une phrase exacte, vous indiquerez e) (« phrase exacte »).' q_dict['verbal'][11]['answers_vec'] = [ 'Les consommateurs /', 'ont des droits /', 'qui ne sont pas /', 'toujours connu. /', '« phrase exacte »/' ] q_dict['verbal'][11]['solution'] = 'd' q_dict['verbal'][11]['ids_vec'] = ids_out(q_dict['verbal'][11]['answers_vec']) q_dict['verbal'][11]['images'] = 0 q_dict['verbal'][11]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.8' q_dict['verbal'][12]['instructions'] = "" q_dict['verbal'][12]['question'] = 'Les phrases ci-dessous ont ete déposés en promotions a, b, c, d. Repérez dans quelle partie de la phrase se trouve la faute et indiquez-le. Pour une phrase exacte, vous indiquerez e) (« phrase exacte »).' q_dict['verbal'][12]['answers_vec'] = ['Quelque soit /', " l'évolution de /", "la situation, je n'y /", 'retournerai pas. /', '« phrase exacte »/'] q_dict['verbal'][12]['solution'] = 'a' q_dict['verbal'][12]['ids_vec'] = ids_out(q_dict['verbal'][12]['answers_vec']) q_dict['verbal'][12]['images'] = 0 q_dict['verbal'][12]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.8' q_dict['verbal'][13]['instructions'] = "" q_dict['verbal'][13]['question'] = 'Les phrases ci-dessous ont ete déposés en promotions a, b, c, d. Repérez dans quelle partie de la phrase se trouve la faute et indiquez-le. Pour une phrase exacte, vous indiquerez e) (« phrase exacte »).' q_dict['verbal'][13]['answers_vec'] = ['Les participants /', 'ont respecté /', 'tous leurs engagements /', "malgré de l'adversité. /", '« phrase exacte » /'] q_dict['verbal'][13]['solution'] = 'e' q_dict['verbal'][13]['ids_vec'] = ids_out(q_dict['verbal'][13]['answers_vec']) q_dict['verbal'][13]['images'] = 0 q_dict['verbal'][13]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.9' q_dict['verbal'][14]['instructions'] = "" q_dict['verbal'][14]['question'] = 'Les phrases ci-dessous ont ete déposés en promotions a, b, c, d. Repérez dans quelle partie de la phrase se trouve la faute et indiquez-le. Pour une phrase exacte, vous indiquerez e) (« phrase exacte »).' q_dict['verbal'][14]['answers_vec'] = ['La robe que /', "j'ai acheté hier /", 'va très bien /', 'à mon teint. /', '« phrase exacte »/'] q_dict['verbal'][14]['solution'] = 'b' q_dict['verbal'][14]['ids_vec'] = ids_out(q_dict['verbal'][14]['answers_vec']) q_dict['verbal'][14]['images'] = 0 q_dict['verbal'][14]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.10' q_dict['verbal'][15]['instructions'] = '' q_dict['verbal'][15]['question'] ='Les phrases ci-dessous ont ete déposés en promotions a, b, c, d. Repérez dans quelle partie de la phrase se trouve la faute et indiquez-le. Pour une phrase exacte, vous indiquerez e) (« phrase exacte »).' q_dict['verbal'][15]['answers_vec'] = ['Les enfants se sont /', 'longtemps souvenus de /', 'leurs vacances passés /', 'à la campagne. /', '« phrase exacte »/'] q_dict['verbal'][15]['solution'] = 'c' q_dict['verbal'][15]['ids_vec'] = ids_out(q_dict['verbal'][15]['answers_vec']) q_dict['verbal'][15]['images'] = 0 q_dict['verbal'][15]['source'] = 'tests_vocab_grammar_math.pdf, p.2, q4.10' q_dict['verbal'][16]['instructions'] = "À l'aide des trois des trois propositions affectées d’une lettre, définir celle qui correspond au mot écrit en italique.
" q_dict['verbal'][16]['question'] = "Elle l’a tancé vertement." q_dict['verbal'][16]['answers_vec'] = ['injuré', 'réprimandé', 'récompensé'] q_dict['verbal'][16]['solution'] = 'b' q_dict['verbal'][16]['ids_vec'] = ids_out(q_dict['verbal'][16]['answers_vec']) q_dict['verbal'][16]['images'] = 0 q_dict['verbal'][16]['source'] = 'tests_vocab_grammar_math.pdf, p.8 ff, ex1.1' q_dict['verbal'][17]['instructions'] = "À l'aide des trois des trois propositions affectées d’une lettre, définir celle qui correspond au mot écrit en italique.
" q_dict['verbal'][17]['question'] = "Il a parodié cet écrit. " q_dict['verbal'][17]['answers_vec'] = ['retranscrit', 'imprimé', 'imité' ] q_dict['verbal'][17]['solution'] = 'c' q_dict['verbal'][17]['ids_vec'] = ids_out(q_dict['verbal'][17]['answers_vec']) q_dict['verbal'][17]['images'] = 0 q_dict['verbal'][17]['source'] = 'tests_vocab_grammar_math.pdf, p.8 ff, ex1.2' q_dict['verbal'][18]['instructions'] = "À l'aide des trois des trois propositions affectées d’une lettre, définir celle qui correspond au mot écrit en italique.
" q_dict['verbal'][18]['question'] = "Il a prononcé à son égard des propos graveleux. " q_dict['verbal'][18]['answers_vec'] = ['licencieux', 'empreints de gravité', 'élogieux'] q_dict['verbal'][18]['solution'] = 'a' q_dict['verbal'][18]['ids_vec'] = ids_out(q_dict['verbal'][18]['answers_vec']) q_dict['verbal'][18]['images'] = 0 q_dict['verbal'][18]['source'] = 'tests_vocab_grammar_math.pdf, p.8 ff, ex1.3' q_dict['verbal'][19]['instructions'] = "À l'aide des trois des trois propositions affectées d’une lettre, définir celle qui correspond au mot écrit en italique.
" q_dict['verbal'][19]['question'] = "Elle a fignolé son ouvrage." q_dict['verbal'][19]['answers_vec'] = ['bâclé', 'exécuté avec soin', 'travaillé grossièrement' ] q_dict['verbal'][19]['solution'] = 'b' q_dict['verbal'][19]['ids_vec'] = ids_out(q_dict['verbal'][19]['answers_vec']) q_dict['verbal'][19]['images'] = 0 q_dict['verbal'][19]['source'] = 'tests_vocab_grammar_math.pdf, p.8 ff, ex1.4' q_dict['verbal'][20]['instructions'] = "À l'aide des trois des trois propositions affectées d’une lettre, définir celle qui correspond au mot écrit en italique.
" q_dict['verbal'][20]['question'] = "Le fringant argousin. " q_dict['verbal'][20]['answers_vec'] = ['commerçant', 'amoureux', 'argent de police'] q_dict['verbal'][20]['solution'] = 'c' q_dict['verbal'][20]['ids_vec'] = ids_out(q_dict['verbal'][20]['answers_vec']) q_dict['verbal'][20]['images'] = 0 q_dict['verbal'][20]['source'] = 'tests_vocab_grammar_math.pdf, p.8 ff, ex1.5' q_dict['verbal'][21]['instructions'] = "" q_dict['verbal'][21]['question'] = "Trouvez la bonne solution.
Lourd est à pesant ce que vieux est à..." q_dict['verbal'][21]['answers_vec'] = ['jeune', 'âgé', 'usé', 'doyen'] q_dict['verbal'][21]['solution'] = 'b' q_dict['verbal'][21]['ids_vec'] = ids_out(q_dict['verbal'][21]['answers_vec']) q_dict['verbal'][21]['images'] = 0 q_dict['verbal'][21]['source'] = 'tests_vocab_grammar_math.pdf, p.131 ff, ex1' q_dict['verbal'][22]['instructions'] = "" q_dict['verbal'][22]['question'] = "Trouvez la bonne solution.
Épargner est à dépenser, ce que trouver est à..." q_dict['verbal'][22]['answers_vec'] = ['gagner', 'chercher', 'oublier', 'repérer'] q_dict['verbal'][22]['solution'] = 'b' q_dict['verbal'][22]['ids_vec'] = ids_out(q_dict['verbal'][22]['answers_vec']) q_dict['verbal'][22]['images'] = 0 q_dict['verbal'][22]['source'] = 'tests_vocab_grammar_math.pdf, p.131 ff, ex2' q_dict['verbal'][23]['instructions'] = "" q_dict['verbal'][23]['question'] = "Trouvez la bonne solution.
Écaille est à poisson ce que... est à oiseau. " q_dict['verbal'][23]['answers_vec'] = ['voler', 'aile', 'pigeon', 'plume'] q_dict['verbal'][23]['solution'] = 'd' q_dict['verbal'][23]['ids_vec'] = ids_out(q_dict['verbal'][23]['answers_vec']) q_dict['verbal'][23]['images'] = 0 q_dict['verbal'][23]['source'] = 'tests_vocab_grammar_math.pdf, p.131 ff, ex3' q_dict['verbal'][24]['instructions'] = "" q_dict['verbal'][24]['question'] = "Trouvez la bonne solution.
Chirurgien est à guérison, ce que stratège est à..." q_dict['verbal'][24]['answers_vec'] = ['victoire', 'plans', 'promotion', 'commandement'] q_dict['verbal'][24]['solution'] = 'a' q_dict['verbal'][24]['ids_vec'] = ids_out(q_dict['verbal'][24]['answers_vec']) q_dict['verbal'][24]['images'] = 0 q_dict['verbal'][24]['source'] = 'tests_vocab_grammar_math.pdf, p.131 ff, ex4' q_dict['verbal'][25]['instructions'] = "" q_dict['verbal'][25]['question'] = "Trouvez la bonne solution.
Oreiller est à plume ce que fauteuil est à... " q_dict['verbal'][25]['answers_vec'] = ['velours', 'siège', 'meuble', 'crin'] q_dict['verbal'][25]['solution'] = 'd' q_dict['verbal'][25]['ids_vec'] = ids_out(q_dict['verbal'][25]['answers_vec']) q_dict['verbal'][25]['images'] = 0 q_dict['verbal'][25]['source'] = 'tests_vocab_grammar_math.pdf, p.131 ff, ex5' #
fol for l in range(1, 26): q_dict['verbal'][l]['grammar'] = 0 if l > 10 and l < 16: q_dict['verbal'][l]['grammar'] = 1 #stopped here. look at tests_logique.pdf, p.131 def creating_session(subsession): treatments = itertools.cycle(['A', 'B']) subsession.session.vars['scores'] = dict() subsession.session.vars['active_dict'] = dict() subsession.session.vars['done_dict'] = dict() subsession.session.vars['executed'] = 0 for p in subsession.get_players(): p.errori = 0 #time, in seconds p.participant.vars['time'] = Constants.time_task*60 p.participant.vars['expiry'] = 0 p.participant.vars['task_order'] = Constants.order_lt.copy() # variables for comprehension tests p.participant.vars['test_tries'] = 0 p.participant.vars['test_1'] = 0 p.participant.vars['test_2'] = 0 p.participant.vars['test_3'] = 0 # keeps track of score p.participant.vars['score'] = 0 # keeps track of time when last correct answer was given p.participant.vars['time_last_correct'] = 0 p.participant.vars['group'] = next(treatments) p.session.vars['active_dict'][p.participant.id_in_session] = 0 p.session.vars['done_dict'][p.participant.id_in_session] = 0 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): difficulty = models.IntegerField( label=''' Sur une échelle de 1 à 10, à quel point avez-vous trouvé le test difficile (1 signifie très facile, 10 signifie très difficile)''', choices=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], widget=widgets.RadioSelectHorizontal ) belief_50_s = models.FloatField(min=0, max=100) belief_A_s = models.FloatField(min=0, max=100) belief_50_o = models.FloatField(min=0, max=100) belief_A_o = models.FloatField(min=0, max=100) belief = models.FloatField(min=0, max=100) errori = models.FloatField() answer = models.StringField() correct_answer = models.IntegerField() test_type = models.StringField( choices=['trivia', 'logic', 'math', 'verbal'], widget=widgets.RadioSelect, label='Please choose a type of test.' ) test_1 = models.IntegerField() test_2 = models.IntegerField() test_3 = models.IntegerField() test_tries = models.IntegerField() score = models.IntegerField() # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # PAGES # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class Introduction(Page): def before_next_page(player: Player, timeout_happened): player.session.vars['active_dict'][player.participant.id_in_session] = 1 @staticmethod def is_displayed(player: Player): return player.round_number == 1 class InstructionsTest(Page): @staticmethod def is_displayed(player: Player): return player.round_number == 1 def before_next_page(player: Player, timeout_happened): player.session.vars['active_dict'][player.participant.id_in_session] = 1 class Instructions1(Page): form_model = 'player' form_fields = ['test_1', 'test_2', 'test_3'] def is_displayed(self): return self.round_number == 1 def error_message(player, value): bb = value['test_1'] + value['test_2'] + value['test_3'] # to kick out people answering wrong more than 3 times add to conditions "and self.player.test_tries == 2" if bb != 3: player.participant.vars['test_tries'] = player.participant.vars['test_tries'] + 1 player.test_tries = player.participant.vars['test_tries'] player.participant.vars['test_1'] = value['test_1'] player.participant.vars['test_2'] = value['test_2'] player.participant.vars['test_3'] = value['test_3'] return "Vous avez mal répondu à au moins une des questions. Veuillez lire les conseils ci-dessous et" \ " assurez-vous de bien comprendre la tâche." def vars_for_template(player: Player): error = 0 if player.participant.vars['test_tries'] > 0: error = 1 return dict( error=error, test_1=player.participant.vars['test_1'], test_2=player.participant.vars['test_2'], test_3=player.participant.vars['test_3'], ) class ChooseTest(Page): form_model = 'player' form_fields = ['test_type'] def before_next_page(player: Player, timeout_happened): player.participant.vars['test_type'] = player.test_type def is_displayed(player: Player): return player.round_number == 1 class start_task(Page): @staticmethod def is_displayed(player: Player): return player.round_number == 1 @staticmethod def before_next_page(player, timeout_happened): participant = player.participant import time # remember to add 'expiry' to PARTICIPANT_FIELDS. player.participant.vars['expiry'] = time.time() + 1*player.participant.vars['time'] player.participant.vars['score'] = 0 def vars_for_template(player: Player): return dict( expiry=player.participant.vars['expiry'], ) def get_timeout_seconds(player): participant = player.participant import time return player.participant.vars['expiry'] - time.time() class Task(Page): form_model = 'player' form_fields = ['answer'] timer_text = 'Temps restant:' @staticmethod def get_timeout_seconds(player): participant = player.participant import time return player.participant.vars['expiry'] - time.time() get_timeout_seconds = get_timeout_seconds @staticmethod def is_displayed(player: Player): # if player.participant.vars['test_type'] == 'trivia' and get_timeout_seconds(player) > 0: if get_timeout_seconds(player) > 0: return player.round_number < 41 else: return get_timeout_seconds(player) > 0 def vars_for_template(player: Player): test_type = player.participant.vars['task_order'][player.round_number - 1][0] test_number = player.participant.vars['task_order'][player.round_number - 1][1] info = Constants.q_dict[test_type][test_number] # info = Constants.q_dict['trivia'][22] # grammar = 0 # if test_type == 'verbal' and player.round_number > 10 and player.round_number < 16: # grammar = 1 return dict( grammar=info['grammar'], zip_answers1=zip(info['answers_vec'], info['ids_vec'], info['ids_vec']), zip_answers2=zip(info['answers_vec'], info['ids_vec'], info['ids_vec']), question=info['question'], instructions=info['instructions'], images=info['images'], width=info['width'], round_number=player.round_number, test_type=player.participant.vars['task_order'][player.round_number - 1][0], ## for testing score=player.participant.vars['score'], time_last_correct=player.participant.vars['time_last_correct'], solution=info['solution'], ) def before_next_page(player: Player, timeout_happened): test_type = player.participant.vars['task_order'][player.round_number - 1][0] test_number = player.participant.vars['task_order'][player.round_number - 1][1] info = Constants.q_dict[test_type][test_number] player.correct_answer = 0 if player.answer == info['solution']: player.correct_answer = 1 player.participant.vars['score'] += 1 player.participant.vars['time_last_correct'] = get_timeout_seconds(player) # when done with task, put score etc into session dict if player.round_number == 40: player.session.vars['scores'][player.id_in_subsession] = [player.participant.vars['score'], - player.participant.vars['time_last_correct']] player.session.vars['done_dict'][player.participant.id_in_session] = 1 class Feedback0(Page): def is_displayed(player: Player): return player.round_number > 40 def vars_for_template(player: Player): return dict( score=player.participant.vars['score'], ) class Feedback0Test(Page): def is_displayed(player: Player): return player.round_number > 40 def vars_for_template(player: Player): return dict( score=player.participant.vars['score'], ) class Instructions2(Page): def is_displayed(player: Player): return player.round_number > 40 def vars_for_template(player: Player): id_p_2 = list() id_e_2 = list() id_r_2 = list() value_2 = list() style_2 = list() CR_2 = list() for i in range(10): style_2.append("style='display: table; background-color: white'") CR_2.append("D" + str(i * 10) +"_2") v = i * 10 value_2.append(v) id_p_2.append("PD" + str(v)+"_2") id_e_2.append("ED" + str(v)+"_2") id_r_2.append("RD" + str(v)+"_2") for j in range(10): style_2.append("style='display: none; background-color: whitesmoke'") CR_2.append("I" + str(i * 10)+"_2") v = i * 10 + j value_2.append(v) id_p_2.append("PI" + str(v)+"_2") id_e_2.append("EI" + str(v)+"_2") id_r_2.append("RI" + str(v)+"_2") CR_2.append("D" + str(100)+"_2") style_2.append("style='display: table; background-color: white'") v = 100 value_2.append(v) id_p_2.append("PD" + str(v)+"_2") id_e_2.append("ED" + str(v)+"_2") id_r_2.append("RD" + str(v)+"_2") # display = ["style='display: none'", "style='display: none'", "style='display: none'", "style='display: none'", # "style='display: none'", "style='display: none'", "style='display: none'", "style='display: none'", # "style='display: none'", "style='display: none'", "style='display: none'"] # idR = ["ER0", "ER1", "ER2", "ER3", "ER4", "ER5", "ER6", "ER7", "ER8", "ER9", "ER10"] return dict( zip_table_2=zip(value_2, id_e_2, id_p_2, style_2, CR_2, id_r_2), value_2=value_2, error=0, event_1="coin lands heads", belief_variable_1="belief_50_s", ) @staticmethod def js_vars(player: Player): return dict( belief_variable_1="belief_50_s" ) class Belief0(Page): form_model = 'player' form_fields = ['belief_50_s'] class Belief50(Page): form_model = 'player' form_fields = ['belief_50_s', 'belief_50_o', 'errori'] def is_displayed(player: Player): return player.round_number > 40 # def error_message(player: Player, values): # if values['errori'] == 1: # return "Please choose something." def vars_for_template(player: Player): player.errori = 1 id_p = list() id_e = list() id_r = list() value = list() style = list() CR = list() for i in range(10): style.append("style='display: table; background-color: white'") CR.append("D" + str(i * 10)) v = i * 10 value.append(v) id_p.append("PD" + str(v)) id_e.append("ED" + str(v)) id_r.append("RD" + str(v)) for j in range(10): style.append("style='display: none; background-color: whitesmoke'") CR.append("I" + str(i * 10)) v = i * 10 + j value.append(v) id_p.append("PI" + str(v)) id_e.append("EI" + str(v)) id_r.append("RI" + str(v)) CR.append("D" + str(100)) style.append("style='display: table; background-color: white'") v = 100 value.append(v) id_p.append("PD" + str(v)) id_e.append("ED" + str(v)) id_r.append("RD" + str(v)) id_p_2 = list() id_e_2 = list() id_r_2 = list() value_2 = list() style_2 = list() CR_2 = list() for i in range(10): style_2.append("style='display: table; background-color: white'") CR_2.append("D" + str(i * 10) +"_2") v = i * 10 value_2.append(v) id_p_2.append("PD" + str(v)+"_2") id_e_2.append("ED" + str(v)+"_2") id_r_2.append("RD" + str(v)+"_2") for j in range(10): style_2.append("style='display: none; background-color: whitesmoke'") CR_2.append("I" + str(i * 10)+"_2") v = i * 10 + j value_2.append(v) id_p_2.append("PI" + str(v)+"_2") id_e_2.append("EI" + str(v)+"_2") id_r_2.append("RI" + str(v)+"_2") CR_2.append("D" + str(100)+"_2") style_2.append("style='display: table; background-color: white'") v = 100 value_2.append(v) id_p_2.append("PD" + str(v)+"_2") id_e_2.append("ED" + str(v)+"_2") id_r_2.append("RD" + str(v)+"_2") # display = ["style='display: none'", "style='display: none'", "style='display: none'", "style='display: none'", # "style='display: none'", "style='display: none'", "style='display: none'", "style='display: none'", # "style='display: none'", "style='display: none'", "style='display: none'"] # idR = ["ER0", "ER1", "ER2", "ER3", "ER4", "ER5", "ER6", "ER7", "ER8", "ER9", "ER10"] return dict( zip_table=zip(value, id_e, id_p, style, CR, id_r), zip_table_2=zip(value_2, id_e_2, id_p_2, style_2, CR_2, id_r_2), value_2=value_2, event_1="I am in top 50", event_2="other is in top 50", belief_variable_1="belief_50_s", belief_variable_2="belief_50_o", # to be changed score_self=player.participant.vars['score'], score_other=10, time_self=round(Constants.time_task*60 - player.participant.vars['time_last_correct'], 3), time_other=4, ) @staticmethod def js_vars(player: Player): return dict( belief_variable_1="belief_50_s", belief_variable_2="belief_50_o", ) class BeliefA(Page): form_model = 'player' form_fields = ['belief_A_s', 'belief_A_o', 'errori'] def is_displayed(player: Player): return player.round_number > 40 def error_message(player: Player, values): if values['errori'] == 1: return "Please choose something." def vars_for_template(player: Player): player.errori = 1 id_p = list() id_e = list() id_r = list() value = list() style = list() CR = list() for i in range(10): style.append("style='display: table; background-color: white'") CR.append("D" + str(i * 10)) v = i * 10 value.append(v) id_p.append("PD" + str(v)) id_e.append("ED" + str(v)) id_r.append("RD" + str(v)) for j in range(10): style.append("style='display: none; background-color: whitesmoke'") CR.append("I" + str(i * 10)) v = i * 10 + j value.append(v) id_p.append("PI" + str(v)) id_e.append("EI" + str(v)) id_r.append("RI" + str(v)) CR.append("D" + str(100)) style.append("style='display: table; background-color: white'") v = 100 value.append(v) id_p.append("PD" + str(v)) id_e.append("ED" + str(v)) id_r.append("RD" + str(v)) id_p_2 = list() id_e_2 = list() id_r_2 = list() value_2 = list() style_2 = list() CR_2 = list() for i in range(10): style_2.append("style='display: table; background-color: white'") CR_2.append("D" + str(i * 10) +"_2") v = i * 10 value_2.append(v) id_p_2.append("PD" + str(v)+"_2") id_e_2.append("ED" + str(v)+"_2") id_r_2.append("RD" + str(v)+"_2") for j in range(10): style_2.append("style='display: none; background-color: whitesmoke'") CR_2.append("I" + str(i * 10)+"_2") v = i * 10 + j value_2.append(v) id_p_2.append("PI" + str(v)+"_2") id_e_2.append("EI" + str(v)+"_2") id_r_2.append("RI" + str(v)+"_2") CR_2.append("D" + str(100)+"_2") style_2.append("style='display: table; background-color: white'") v = 100 value_2.append(v) id_p_2.append("PD" + str(v)+"_2") id_e_2.append("ED" + str(v)+"_2") id_r_2.append("RD" + str(v)+"_2") # display = ["style='display: none'", "style='display: none'", "style='display: none'", "style='display: none'", # "style='display: none'", "style='display: none'", "style='display: none'", "style='display: none'", # "style='display: none'", "style='display: none'", "style='display: none'"] # idR = ["ER0", "ER1", "ER2", "ER3", "ER4", "ER5", "ER6", "ER7", "ER8", "ER9", "ER10"] return dict( zip_table=zip(value, id_e, id_p, style, CR, id_r), zip_table_2=zip(value_2, id_e_2, id_p_2, style_2, CR_2, id_r_2), value_2=value_2, event_1="I am in Group A", event_2="other is in Group A", belief_variable_1="belief_A_s", belief_variable_2="belief_A_o", # to be changed score_self=player.participant.vars['score'], score_other=10, time_self=round(Constants.time_task*60 - player.participant.vars['time_last_correct'], 3), time_other=4, ) @staticmethod def js_vars(player: Player): return dict( belief_variable_1="belief_A_s", belief_variable_2="belief_A_o", ) class InstrEnd2(Page): pass class Instructions3(Page): pass class Belief2(Page): form_model = 'player' form_fields = ['belief_50_s', 'belief_A_s'] class Choice(Page): pass class BeliefMPL2(Page): form_model = 'player' form_fields = ['belief', 'errori'] def error_message(player: Player, values): if values['errori'] == 1: return "Please choose something." def vars_for_template(player: Player): player.errori = 1 id_p = list() id_e = list() id_r = list() value = list() style = list() CR = list() for i in range(10): style.append("style='display: table; background-color: lightblue'") CR.append("D" + str(i * 10)) v = i * 10 value.append(v) id_p.append("PD" + str(v)) id_e.append("ED" + str(v)) id_r.append("RD" + str(v)) for j in range(10): style.append("style='display: none; background-color: white'") CR.append("I" + str(i * 10)) v = i * 10 + j value.append(v) id_p.append("PI" + str(v)) id_e.append("EI" + str(v)) id_r.append("RI" + str(v)) CR.append("D" + str(100)) style.append("style='display: table; background-color: lightblue'") v = 100 value.append(v) id_p.append("PD" + str(v)) id_e.append("ED" + str(v)) id_r.append("RD" + str(v)) # display = ["style='display: none'", "style='display: none'", "style='display: none'", "style='display: none'", # "style='display: none'", "style='display: none'", "style='display: none'", "style='display: none'", # "style='display: none'", "style='display: none'", "style='display: none'"] # idR = ["ER0", "ER1", "ER2", "ER3", "ER4", "ER5", "ER6", "ER7", "ER8", "ER9", "ER10"] return dict( zip_table=zip(value, id_e, id_p, style, CR, id_r), ) class BeliefMPL(Page): form_model = 'player' form_fields = ['belief'] def vars_for_template(player: Player): value_p = list() id_p = list() id_e = list() id_r = list() for i in range(0, 101): value_p.append(i) id_p.append("P" + str(i)) id_e.append("E" + str(i)) id_r.append("R" + str(i)) value_e = list() for i in range(1, 102): value_e.append(i) style = list() CR = list() for i in range(11): style.append("style='display: table; background-color: lightblue'") CR.append("D" + str(i*10)) for j in range(9): style.append("style='display: none; background-color: white'") CR.append("I" + str(i*10)) # display = ["style='display: none'", "style='display: none'", "style='display: none'", "style='display: none'", # "style='display: none'", "style='display: none'", "style='display: none'", "style='display: none'", # "style='display: none'", "style='display: none'", "style='display: none'"] # idR = ["ER0", "ER1", "ER2", "ER3", "ER4", "ER5", "ER6", "ER7", "ER8", "ER9", "ER10"] return dict( zip_table=zip(value_e, id_e, value_p, id_p, style, CR, id_r), ) class Belief2pages(Page): form_model = 'player' form_fields = ['belief_50_s', 'belief_50_o', 'errori'] def is_displayed(player: Player): return player.round_number == 1 def error_message(player: Player, values): if values['errori'] == 1: return "Please choose something." def vars_for_template(player: Player): player.errori = 1 id_p = list() id_e = list() id_r = list() value = list() style = list() CR = list() for i in range(10): style.append("style='display: table; background-color: white'") CR.append("D" + str(i * 10)) v = i * 10 value.append(v) id_p.append("PD" + str(v)) id_e.append("ED" + str(v)) id_r.append("RD" + str(v)) for j in range(10): style.append("style='display: none; background-color: whitesmoke'") CR.append("I" + str(i * 10)) v = i * 10 + j value.append(v) id_p.append("PI" + str(v)) id_e.append("EI" + str(v)) id_r.append("RI" + str(v)) CR.append("D" + str(100)) style.append("style='display: table; background-color: white'") v = 100 value.append(v) id_p.append("PD" + str(v)) id_e.append("ED" + str(v)) id_r.append("RD" + str(v)) id_p_2 = list() id_e_2 = list() id_r_2 = list() value_2 = list() style_2 = list() CR_2 = list() for i in range(10): style_2.append("style='display: table; background-color: white'") CR_2.append("D" + str(i * 10) +"_2") v = i * 10 value_2.append(v) id_p_2.append("PD" + str(v)+"_2") id_e_2.append("ED" + str(v)+"_2") id_r_2.append("RD" + str(v)+"_2") for j in range(10): style_2.append("style='display: none; background-color: whitesmoke'") CR_2.append("I" + str(i * 10)+"_2") v = i * 10 + j value_2.append(v) id_p_2.append("PI" + str(v)+"_2") id_e_2.append("EI" + str(v)+"_2") id_r_2.append("RI" + str(v)+"_2") CR_2.append("D" + str(100)+"_2") style_2.append("style='display: table; background-color: white'") v = 100 value_2.append(v) id_p_2.append("PD" + str(v)+"_2") id_e_2.append("ED" + str(v)+"_2") id_r_2.append("RD" + str(v)+"_2") # display = ["style='display: none'", "style='display: none'", "style='display: none'", "style='display: none'", # "style='display: none'", "style='display: none'", "style='display: none'", "style='display: none'", # "style='display: none'", "style='display: none'", "style='display: none'"] # idR = ["ER0", "ER1", "ER2", "ER3", "ER4", "ER5", "ER6", "ER7", "ER8", "ER9", "ER10"] return dict( zip_table=zip(value, id_e, id_p, style, CR, id_r), zip_table_2=zip(value_2, id_e_2, id_p_2, style_2, CR_2, id_r_2), value_2=value_2, error=0, event="I am in top 50", ) ###protocol for wait page def group_by_arrival_time_method(subsession, waiting_players): Players = [p for p in waiting_players] # this assigns rank to players. # code is carried out once, after everybody is done with task # this code checks that everyone who started is done all_done = 0 active =list() for i in subsession.session.vars['ActiveDict']: if subsession.session.vars['ActiveDict'][i] == 1: active.append(i) for i in active: if subsession.session.vars['DoneDict'][i] != 1: all_done = 0 # determines ranking if all_done == 1 and subsession.session.vars['executed'] == 0: Players = [p for p in subsession.get_players() if subsession.session.vars['ActiveDict'][p.participant.id_in_session] == 1] subsession.session.vars['executed'] += 1 scores = subsession.session.vars['scores'] sorted_scores = {k: v for k, v in sorted(scores.items(), key=lambda item: item[1], reverse=True)} ranks = dict() count = 1 for i in sorted_scores: ranks[i] = count count += 1 #determines whether player receives bonus or not info = dict() for p in Players: info[p.participant.id_in_session]['rank'] = ranks[p.participant.id_in_session] info[p.participant.id_in_session]['group'] = p.participant.vars['group'] info[p.participant.id_in_session]['bonus'] = 0 if p.participant.vars['group'] == 'A' and ranks[p.participant.id_in_session] <= 0.75 * len(active): info[p.participant.id_in_session]['bonus'] = 1 elif p.participant.vars['group'] == 'B' and ranks[p.participant.id_in_session] <= 0.25 * len(active): info[p.participant.id_in_session]['bonus'] = 1 class WaitMatch(WaitPage): group_by_arrival_time = True class Difficulty(Page): form_model = 'player' form_fields = ['difficulty'] def is_displayed(player: Player): return player.round_number == 40 def before_next_page(player: Player, timeout_happened): player.score = player.participant.vars['score'] player.test_type = player.participant.vars['task_order'][player.round_number - 1][0] # page_sequence = [Introduction, Instructions1, Task, Feedback0, Instructions2, Belief0, Belief, InstrEnd2, Instructions3, Belief2, Choice] page_sequence = [InstructionsTest, start_task, Task, Feedback0Test, Difficulty]