// ##################################################################### // // W A R N I N G // // This Javascript code is a copyright work. You do NOT have permission // to copy, store, modify, reproduce, retransmit or distribute it. Your // download has been recorded and date-stamped by our web server, along // with details of your internet service provider DNS and IP number. // // ##################################################################### // // English Forum is a public service website // http://www.english-forum.com // Email: admin@english-forum.com // // Irregular Verbs Quiz javascript (c) copyright 2001 Nikolay Babin // Website and javascript portions (c) copyright 2001 English Forum // // // ##################################################################### // ##################################################################### // // English Forum modifications 25 Oct 2001 marked: // # mod 10.01 // // ##################################################################### function iw_cat(base,pasts, pastp, used, teststatus) { this.base = base; this.pasts = pasts; this.pastp = pastp; this.active = 0; this.used = 0; this.teststatus = 0; } category_iw = new Array( new iw_cat("awake", "awoke", "awoken", 0,0, 0), new iw_cat("be", "was,were", "been", 0,0, 0), new iw_cat("beat", "beat", "beaten", 0,0, 0), new iw_cat("become", "became", "become", 0,0, 0), new iw_cat("begin", "began", "begun", 0,0, 0), new iw_cat("bend", "bent", "bent", 0,0, 0), new iw_cat("bet", "bet", "bet", 0,0, 0), new iw_cat("bid", "bid", "bid", 0,0, 0), new iw_cat("bite", "bit", "bitten", 0,0, 0), new iw_cat("blow", "blew", "blown", 0,0, 0), new iw_cat("break", "broke", "broken", 0,0, 0), new iw_cat("bring", "brought", "brought", 0,0, 0), new iw_cat("build", "built", "built", 0,0, 0), new iw_cat("burn", "burned,burnt", "burned,burnt",0, 0, 0), new iw_cat("buy", "bought", "bought", 0,0, 0), new iw_cat("catch", "caught", "caught", 0,0, 0), new iw_cat("choose", "chose", "chosen", 0,0, 0), new iw_cat("come", "came", "come", 0,0, 0), new iw_cat("cost", "cost", "cost", 0,0, 0), new iw_cat("cut", "cut", "cut", 0,0, 0), new iw_cat("dig", "dug", "dug", 0,0, 0), new iw_cat("do", "did", "done", 0,0, 0), new iw_cat("draw", "drew", "drawn", 0,0, 0), new iw_cat("dream", "dreamed,dreamt", "dreamed,dreamt", 0,0, 0), new iw_cat("drive", "drove", "driven", 0,0, 0), new iw_cat("drink", "drank", "drunk", 0,0, 0), new iw_cat("eat", "ate", "eaten", 0,0, 0), new iw_cat("fall", "fell", "fallen", 0,0, 0), new iw_cat("feel", "felt", "felt", 0,0, 0), new iw_cat("fight", "fought", "fought", 0,0, 0), new iw_cat("find", "found", "found", 0,0, 0), new iw_cat("fly", "flew", "flown", 0,0, 0), new iw_cat("forget", "forgot", "forgotten", 0,0, 0), new iw_cat("forgive", "forgave", "forgiven", 0,0, 0), new iw_cat("freeze", "froze", "frozen", 0,0, 0), new iw_cat("get", "got", "got,gotten", 0,0, 0), new iw_cat("give", "gave", "given", 0,0, 0), new iw_cat("go", "went", "gone", 0,0, 0), new iw_cat("grow", "grew", "grown", 0,0, 0), new iw_cat("hang", "hung", "hung", 0,0, 0), new iw_cat("have", "had", "had", 0,0, 0), new iw_cat("hear", "heard", "heard", 0,0, 0), new iw_cat("hide", "hid", "hidden", 0,0, 0), new iw_cat("hit", "hit", "hit", 0,0, 0), new iw_cat("hold", "held", "held", 0,0, 0), new iw_cat("hurt", "hurt", "hurt", 0,0, 0), new iw_cat("keep", "kept", "kept", 0,0, 0), new iw_cat("know", "knew", "known", 0,0, 0), new iw_cat("lay", "laid", "laid", 0,0, 0), new iw_cat("lead", "led", "led", 0,0, 0), new iw_cat("learn", "learned,learnt", "learned,learnt", 0,0, 0), new iw_cat("leave", "left", "left", 0,0, 0), new iw_cat("lend", "lent", "lent", 0,0, 0), new iw_cat("let", "let", "let", 0,0, 0), new iw_cat("lie", "lay", "lain", 0,0, 0), new iw_cat("lose", "lost", "lost", 0,0, 0), new iw_cat("make", "made", "made", 0,0, 0), new iw_cat("mean", "meant", "meant", 0,0, 0), new iw_cat("meet", "met", "met", 0,0, 0), new iw_cat("pay", "paid", "paid", 0,0, 0), new iw_cat("put", "put", "put", 0,0, 0), new iw_cat("read", "read", "read", 0,0, 0), new iw_cat("ride", "rode", "ridden", 0,0, 0), new iw_cat("ring", "rang", "rung", 0,0, 0), new iw_cat("rise", "rose", "risen", 0,0, 0), new iw_cat("run", "ran", "run", 0,0, 0), new iw_cat("say", "said", "said", 0,0, 0), new iw_cat("see", "saw", "seen", 0,0, 0), new iw_cat("sell", "sold", "sold", 0,0, 0), new iw_cat("send", "sent", "sent", 0,0, 0), new iw_cat("show", "showed", "showed,shown", 0,0, 0), new iw_cat("shut", "shut", "shut", 0, 0,0), new iw_cat("sing", "sang", "sung", 0,0, 0), new iw_cat("sit", "sat", "sat", 0, 0,0), new iw_cat("sleep", "slept", "slept", 0,0, 0), new iw_cat("speak", "spoke", "spoken", 0, 0,0), new iw_cat("spend", "spent", "spent", 0,0, 0), new iw_cat("stand", "stood", "stood", 0,0, 0), new iw_cat("swim", "swam", "swum", 0, 0,0), new iw_cat("take", "took", "taken", 0, 0,0) // # mod 10.01 ); var arrlength = category_iw.length; var randomrun = false; var testtype = 1; function getnext() { nextword= getnextword(); if (nextword.base == null) return; var x = getRandom(3) document.form1.tBase.value = ""; document.form1.tPastS.value = ""; document.form1.tPastP.value = ""; if (x == 1) document.form1.tBase.value = nextword.base; else if (x==2) document.form1.tPastS.value = nextword.pasts; else document.form1.tPastP.value = nextword.pastp; } function GetIW(st) { if (document.form1.btnNext.value == " Start "){ document.form1.btnNext.value = " Continue " getnext(); return; } if (checkVal() == false) return; ValidateVal(); curSel = curSel + 1; getnext(); } function ValidateVal() { var val1 = document.form1.tBase.value val1 = NoSpace(val1); var val2 = document.form1.tPastS.value val2 = NoSpace(val2); var val3 = document.form1.tPastP.value val3 = NoSpace(val3); stval = true; if (val1 != category_iw[curSel].base) { stval= false; }else if (val2 != category_iw[curSel].pasts) { var commaPS = category_iw[curSel].pasts.indexOf(","); // # mod 10.01 if (commaPS != -1) { // # mod 10.01 var PS1 = category_iw[curSel].pasts.substring(0,commaPS); // # mod 10.01 var PS2 = category_iw[curSel].pasts.substring(commaPS+1); // # mod 10.01 var PS3 = PS2 + "," + PS1; // # mod 10.01 if ((val2 != PS1) && (val2 != PS2) && (val2 != PS3)) {stval= false} // # mod 10.01 } else {stval= false} }else if (val3 != category_iw[curSel].pastp) { var commaPP = category_iw[curSel].pastp.indexOf(","); // # mod 10.01 if (commaPP != -1) { // # mod 10.01 var PP1 = category_iw[curSel].pastp.substring(0,commaPP); // # mod 10.01 var PP2 = category_iw[curSel].pastp.substring(commaPP+1); // # mod 10.01 var PP3 = PP2 + "," + PP1; // # mod 10.01 if ((val3 != PP1) && (val3 != PP2) && (val3 != PP3)) {stval= false} // # mod 10.01 } else {stval= false;} } if (stval == false){ category_iw[curSel].teststatus = parseInt(category_iw[curSel].teststatus) - 1; window.setTimeout("displayStatus('r')", 50); alert("No, that's not correct!\nThe right answer is:\n\n " + category_iw[curSel].base + "\n " + category_iw[curSel].pasts + "\n " + category_iw[curSel].pastp); // # mod 10.01 document.form1.tBase.focus(); // # mod 10.01 }else{ category_iw[curSel].teststatus = parseInt(category_iw[curSel].teststatus) + 1; window.setTimeout("displayStatus('c')", 50); } } function displayStatus(st) { var str = ""; var scoreval = 0; for (i=0;i < arrlength;i++) scoreval = scoreval + category_iw[i].teststatus; document.form1.tScore.value = scoreval; wordssel = getnumsel(); document.form1.tReq.value = wordssel * testtype; } function NoSpace(val) { re = / /gi val = val.replace(re, "") return val; } function getRandom(n) { var x = Math.random(); x = parseInt(x*100)%n+1 return x; } function checkVal() { if (document.form1.tBase.value == ""){ alert("Base Form is missing.") document.form1.tBase.focus(); return false; } if (document.form1.tPastS.value == "") { alert("Past Simple is missing.") document.form1.tPastS.focus(); return false; } if (document.form1.tPastP.value == ""){ alert("Past Participle is missing.") document.form1.tPastP.focus(); return false; } document.form1.tBase.focus(); return true; } function resettest() { document.form1.btnNext.value = " Start "; //document.form1.tScore.value = 0; //document.form1.tReq.value = 0; document.form1.tBase.value = ""; document.form1.tPastS.value = ""; document.form1.tPastP.value = ""; var dropt =document.form1.drilltype; testtype = dropt.options[dropt.selectedIndex].value; curSel = 0; for (i=0;i < arrlength;i++){ category_iw[i].active = "0"; category_iw[i].teststatus = 0; } var list =document.form1.testopt; var val = list.options[list.selectedIndex].value; selected = val.split(String.fromCharCode(95)) if (selected.length==2) setupwords(selected[0],selected[1]) else setupwordsR(selected[0]) GetIW(1); displayStatus('c'); document.form1.tBase.focus(); } function setupwords(startl, endl) { randomrun = false; startl--;endl--; for (i=startl;i <= endl;i++) category_iw[i].active = '1'; } function setupwordsR(num) { randomrun = true; if (num == "00") { for (i=0;i < arrlength;i++) category_iw[i].active = '1'; return; } for(k = 0; k < num ; k ++){ var rundw = getRandom(arrlength); if (category_iw[rundw] == null) rundw = 30; if (rundw >= arrlength) rundw = arrlength-1; if (category_iw[rundw].active == "1") rundw = getnotused (rundw); category_iw[rundw].active = "1"; } } function getnotused(cur) { for (i=cur;i < arrlength;i++) if (category_iw[i].active != "1") return i; for (i=0;i < arrlength;i++) if (category_iw[i].active != "1") return i; return cur; } function getnextword() { if (randomrun == true){ curSel = getRandom(arrlength); } if (curSel >=category_iw.length) curSel = 0; for (i=curSel;i < arrlength;i++){ if (category_iw[i].teststatus < testtype) if (category_iw[i].active == 1){ curSel = i; return category_iw[i]; } } curSel = 0; //second run for (i=curSel;i < arrlength;i++){ if (category_iw[i].teststatus < testtype) if (category_iw[i].active == 1){ curSel = i; return category_iw[i]; } } alert("Well done! You've reached the Target Score.\n\nTo continue, select different verbs or another level.") // # mod 10.01 resettest(); return "none"; } function getnumsel() { var wordssel = 0; for (j=0;j < arrlength;j++) if (category_iw[j].active == 1) wordssel++; return wordssel; }