var w,h,g,my={};function simonMain(){var version='0.5';my.winRoundN=15 my.btnOffOpacity=0.3 var s='';s+='' my.sndHome=(document.domain=='localhost')?'/mathsisfun/images/sounds/':'/images/sounds/' s+='';s+='';s+='';s+='';my.snds=[];my.soundQ=true for(var i=0;i<4;i++){s+='';} s+='
';s+='
' s+='
' s+='' s+='' s+='' s+='' s+='
' s+='
' s+='
' s+='
' s+='
' s+='';s+=optPopHTML();s+='
';s+='
© 2019 MathsIsFun.com v'+version+'
';s+='
';s+='
';s+='';document.write(s);var el=document.getElementById('canvas1');var ratio=3;el.width=w*ratio;el.height=h*ratio;el.style.width=w+"px";el.style.height=h+"px";g=el.getContext("2d");g.setTransform(ratio,0,0,ratio,0,0);my.buttons=document.getElementsByClassName('simon-button') my.strictQ=false for(var button=0;button':'';} function fade(buttonIndex,fadeSpeed){my.buttons[buttonIndex].style.opacity-=0.1;if(my.buttons[buttonIndex].style.opacity>my.btnOffOpacity){setTimeout(fade.bind(null,buttonIndex),fadeSpeed);}} function winAnim(){var ms=130 var rounds=5 for(var button=0;button0){var div=document.getElementById(name) if(div.currentTime>0&&div.currentTime0)soundPlayQueue();};} function soundToggle(){var btn='sound' if(my.soundQ){my.soundQ=false document.getElementById(btn).classList.add("mute")}else{my.soundQ=true document.getElementById(btn).classList.remove("mute")}} function radioHTML(prompt,id,lbls,checkId,func){var s='';s+='
';s+='
';s+=prompt;s+='
';s+='
';for(var i=0;i';s+='';} s+='
';s+='
';return s;} function optPopHTML(){var s='';s+='
';s+='
';s+='';s+='
';s+='
';return s;} function optPop(){var pop=document.getElementById('optpop');pop.style.transitionDuration="0.3s";pop.style.opacity=1;pop.style.zIndex=my.zIndex+1 pop.style.left=(w-340)/2+'px';} function optYes(){var pop=document.getElementById('optpop');pop.style.opacity=0;pop.style.zIndex=1;pop.style.left='-999px';stockPassBtnUpdate() console.log('optYes',my.suitRule,my.stockPerN,my.stockPassMax,my.tabDropKingQ,my.tabShowFrontQ,my.autoFdnQ)} function optNo(){var pop=document.getElementById('optpop');pop.style.opacity=0;pop.style.zIndex=1;pop.style.left='-999px';} function tabDropKingToggle(){my.tabDropKingQ=!my.tabDropKingQ;toggleBtn("tabDropKingQ",my.tabDropKingQ);} function toggleBtn(btn,onq){if(onq){document.getElementById(btn).classList.add("hi");document.getElementById(btn).classList.remove("lo");}else{document.getElementById(btn).classList.add("lo");document.getElementById(btn).classList.remove("hi");}} CanvasRenderingContext2D.prototype.roundRect=function(x,y,w,h,r){if(w<2*r)r=w/2;if(h<2*r)r=h/2;this.beginPath();this.moveTo(x+r,y);this.arcTo(x+w,y,x+w,y+h,r);this.arcTo(x+w,y+h,x,y+h,r);this.arcTo(x,y+h,x,y,r);this.arcTo(x,y,x+w,y,r);this.closePath();return this;}