4c4 < Run for It Dice Game - RJM Programming - March, 2018 --- > Three or More Dice Game - RJM Programming - March, 2018 22c22 < var d1=7, d2=7, d3=7, d4=7, d5=7, d6=7, ccomma='', lastwinners=''; --- > var d1=7, d2=7, d3=7, d4=7, d5=7, ccomma='', lastwinners=''; 27c27 < document.getElementById('tdr').innerHTML='Six Dice Roll'; --- > document.getElementById('tdr').innerHTML='Five Dice Roll'; 45d44 < d6=7; 63c62 < document.getElementById('tdr').innerHTML='Six Dice Rolls for ' + names[hem] + ' are '; --- > document.getElementById('tdr').innerHTML='Five Dice Rolls for ' + names[hem] + ' are '; 93a93 > 97,103d96 < d6=7; < while (d6 == 7) { < d6=eval(Math.floor(Math.random() * 6) + 1); < } < document.getElementById('actiontd').innerHTML+='
' + document.getElementById('h' + d6).outerHTML.replace(' id="h' + d6 + '"','') + '
'; < //d1+=d6; < 115,116d107 < ccomma=', '; < document.getElementById('tdr').innerHTML+=ccomma + d6; 118c109 < analyze(hem); --- > analyze(hem, true); 134c125 < function analyze(ih) { --- > function analyze(ih, oktor) { 138,146c129,136 < < var ans=prompt(names[ih] + ", you rolled " + document.getElementById('tdr').innerHTML.split(' are ')[1].replace(/\ /g,'') + " ... can you make any sequences that start with 1,2 (and others longer than that such as 1,2,3 or 1,2,3,4)? Tell me what they are, including the commas.",""); < if (ans != null) { < if (ans.replace(/\ /g,'').indexOf('1,2') != -1 && document.getElementById('tdr').innerHTML.split(' are ')[1].indexOf('1') != -1 && document.getElementById('tdr').innerHTML.split(' are ')[1].indexOf('2') != -1) { < //alert("Here with answer of " + ans); < var ansar=ans.replace(/\ /g,'').split(','), allokay=true, thisscore=0; < for (var ia=0; ia //alert(ana); > var lastone=ana[0], inarow=1, twos=[-1,-1], notit=[], iwhich=0; > for (jana=1; jana if (('' + lastone) == ('' + ana[jana])) { > inarow++; > if (inarow == 2) { > twos[iwhich]=eval(lastone); > iwhich++; 148,158c138,140 < if (allokay) { < goes[ih]++; < score[ih]+=thisscore; < document.getElementById('score' + eval(1 + ih)).innerHTML='Score: ' + score[ih] + '/' + goes[ih]; < } else { < goes[ih]++; < document.getElementById('score' + eval(1 + ih)).innerHTML='Score: ' + score[ih] + '/' + goes[ih]; < } < } else { < goes[ih]++; < document.getElementById('score' + eval(1 + ih)).innerHTML='Score: ' + score[ih] + '/' + goes[ih]; --- > } else if (inarow < 3) { > lastone=ana[jana]; > inarow=1; 160a143,222 > if (inarow == 5) { > goes[ih]++; > score[ih]+=12; > document.getElementById('score' + eval(1 + ih)).innerHTML='Score: ' + score[ih] + '/' + goes[ih]; > //alert(5); > } else if (inarow == 4) { > goes[ih]++; > score[ih]+=6; > document.getElementById('score' + eval(1 + ih)).innerHTML='Score: ' + score[ih] + '/' + goes[ih]; > //alert(4); > } else if (inarow == 3) { > goes[ih]++; > score[ih]+=3; > document.getElementById('score' + eval(1 + ih)).innerHTML='Score: ' + score[ih] + '/' + goes[ih]; > //alert(3); > } else if (twos[1] != -1 && oktor) { > var ic=confirm(document.getElementById('tdr').innerHTML.split(' are ')[1] + " ... Keep the " + twos[0] + "'s and reroll is OK and keep the " + twos[1] + "'s and reroll is Cancel"); > if (ic == true) { > //document.getElementById('tdr').innerHTML=document.getElementById('tdr').innerHTML.replace(twos[0], '0' + twos[0]).replace(twos[0], '0' + twos[0]); > ana=document.getElementById('tdr').innerHTML.split(' are ')[1].replace(/\ /g,'').split(','); > for (kana=0; kana if (('' + ana[kana]) != ('' + twos[0])) notit.push(kana); > } > for (idd=0; idd<3; idd++) { > dd=7; > while (dd == 7) { > dd=eval(Math.floor(Math.random() * 6) + 1); > } > ana[notit[idd]]=('' + dd); > } > for (kana=0; kana rew+=rews + ana[kana]; > rews=','; > } > document.getElementById('tdr').innerHTML=document.getElementById('tdr').innerHTML.split(' are ')[0] + ' are ' + rew; > analyze(ih,false); > } else { > //document.getElementById('tdr').innerHTML=document.getElementById('tdr').innerHTML.replace(twos[1], '0' + twos[1]).replace(twos[1], '0' + twos[1]); > ana=document.getElementById('tdr').innerHTML.split(' are ')[1].replace(/\ /g,'').split(','); > for (kana=0; kana if (('' + ana[kana]) != ('' + twos[1])) notit.push(kana); > } > for (idd=0; idd<3; idd++) { > dd=7; > while (dd == 7) { > dd=eval(Math.floor(Math.random() * 6) + 1); > } > ana[notit[idd]]=('' + dd); > } > for (kana=0; kana rew+=rews + ana[kana]; > rews=','; > } > document.getElementById('tdr').innerHTML=document.getElementById('tdr').innerHTML.split(' are ')[0] + ' are ' + rew; > analyze(ih,false); > } > } else if (twos[0] != -1 && oktor) { > alert(document.getElementById('tdr').innerHTML.split(' are ')[1] + " ... Am keeping the " + twos[0] + "'s and rerolling."); > //document.getElementById('tdr').innerHTML=document.getElementById('tdr').innerHTML.replace(twos[0], '0' + twos[0]).replace(twos[0], '0' + twos[0]); > ana=document.getElementById('tdr').innerHTML.split(' are ')[1].replace(/\ /g,'').split(','); > for (kana=0; kana if (('' + ana[kana]) != ('' + twos[0])) notit.push(kana); > } > for (idd=0; idd<3; idd++) { > dd=7; > while (dd == 7) { > dd=eval(Math.floor(Math.random() * 6) + 1); > } > ana[notit[idd]]=('' + dd); > } > for (kana=0; kana rew+=rews + ana[kana]; > rews=','; > } > document.getElementById('tdr').innerHTML=document.getElementById('tdr').innerHTML.split(' are ')[0] + ' are ' + rew; > analyze(ih,false); > } else { > goes[ih]++; > document.getElementById('score' + eval(1 + ih)).innerHTML='Score: ' + score[ih] + '/' + goes[ih]; > } 199c261 < tg+="
Score: 0/0
"; --- > tg+="
Score: 0/0
"; 213c275 <

Run for It Dice Game for
Players

--- >

Three or More Dice Game for
Players

225,226c287,288 <
Player 1

ScoreSix Dice Roll
Player 2

Score <
Score: 0/0
Score: 0/0
--- >
Player 1

ScoreFive Dice Roll
Player 2

Score >
Score: 0/0
Score: 0/0