-
Notifications
You must be signed in to change notification settings - Fork 0
/
puzzle3.min.js
1 lines (1 loc) · 1.17 KB
/
puzzle3.min.js
1
var P3={};P3.solution="";P3.sequence="";P3.getChar="";P3.Init=function(){var a=0;var b=0;for(i=0;i<=3;i++){P3.solution+=Math.floor(Math.random()*10)}for(n=0;n<=P3.solution.length-1;n++){P3.getChar=P3.solution.slice(n,n+1);if(P3.getChar>0&&P3.getChar<9){a=parseInt(P3.getChar)-1;b=a+parseInt(P3.getChar);P3.sequence+=a+""+b}if(P3.getChar==0){a=parseInt(P3.getChar)+1;b=a+parseInt(P3.getChar);P3.sequence+=a+""+b}if(P3.getChar==9){a=parseInt(P3.getChar)+1;b=a+parseInt(P3.getChar);P3.sequence+=a+""+b}}};P3.Render=function(){ctx.strokeStyle="rgb(0, 100, 0)";ctx.strokeRect((c.width/2)-75,80,150,20);ctx.fillStyle="rgb(255, 255, 255)";ctx.fillText("Terminal 3",(c.width/2)-32,95);ctx.strokeRect((c.width/2)-250,100,500,200);ctx.font="24px Arial";ctx.fillStyle="rgb(0, 255, 0)";strSequence=parseInt(P3.sequence).toString(16);ctx.fillText(strSequence.toUpperCase(),255,210);ctx.font="14px Arial"};P3.Update=function(){if(T.GetKeyCode()==13){P3.ShowMsg("HINT","Hexadecimal to decimal - discover the sequence\nType hextodec to convert");P3.ShowMsg("HEXTODEC",P3.sequence);P3.ShowMsg("I GIVE UP",P3.solution)}};P3.GetCode=function(){return(P3.solution)};P3.ShowMsg=function(a,b){if(T.GetCode()==a){alert(b)}};