Source of Jump Game

      <canvas id="canv" width="500" height="500"></canvas>
     
    <script>
      var podiumEvil = false;
      var podiumTime = 0;
      var podiumBgcolor = "black";
      var bgcolor = "white";
      let podiumMaxSize = 20;
      
      var items = new Array(podiumMaxSize);
      
      let guy = "450 400";
      var canv = document.getElementById("canv");
      var ctx = null;
      var on = false;
      var points = 100;
      var g = 150;
      var cle;
      var f=true;
      
      var i = 0;
      var readyTimeTo = false;
      var y = 20;
      var h = 0;
      let z = 0;
      
      function initializeCanvasContext() {
        ctx = canv.getContext("2d");
      }
      
      initializeCanvasContext();
    
      function checkBounds() {
        try {
         for(var k=0; k<items.length; k++) {
         
          if(parseInt(items[k].split(" ")[0])>500)
            items[k] = (80+20*k) + " " + items[k].split(" ")[1];
         }
        } catch(e) {}
      }
      
      function cls() {
        checkBounds();
        
        ctx.fillStyle=bgcolor;
        ctx.fillRect(0, 0, 500, 500);
        ctx.fillStyle="blue";
        ctx.fillRect(guy.split(" ")[0], guy.split(" ")[1], 60, 50);
        if(parseInt(guy.split(" ")[1])>400)
          h=0;
      }
      
      function getX() {
        return Math.floor(Math.random()*25)*60;
      }
      function getY() {
        return y;
      }
      function incY() {
        y += 20;
        if(y == 500)
          y = 0;
        for(var k=0; k<items.length; k++) {
          var xval = items[k].split( " " )[0];
          items[k] = xval + " " + y;
        }
      }
      
      var cursor = 0;
      function getPodium(its) {
        var it;
        if(Math.floor(Math.random()*2)==1){
          it = getX() + " " + getY();
          if(its[cursor]==null)its[cursor] = it;
          else
            its[cursor] = (parseInt(its[cursor].split(" ")[0])+20) + " " + its[cursor].split(" ")[1];
        }
        if(cursor < its.length - 1)
          cursor++;
        else
          cursor = 0;
        return its[cursor];
      }
      
      function draw(its) {
        // items is a array for dynamic size
        for(var k=0; k<items.length; k++) {
          if(parseInt(items[k].split(" ")[0])<=parseInt(guy.split(" ")[0])&&
          parseInt(items[k].split(" ")[0])+20>=parseInt(guy.split(" ")[0])&&
          parseInt(items[k].split(" ")[1])>=parseInt(guy.split(" ")[1])+50&&
          parseInt(items[k].split(" ")[1])<=parseInt(guy.split(" ")[1])+100){
             h=0;
             if(f){
               points++;
               on = true;
               guy = guy.split(" ")[0] + " " + (parseInt(items[k].split(" ")[1])-50);
               g=-0;
             } else {
               on = false;
               f = false;
             }
          }
          ctx.fillStyle = podiumBgcolor;
          ctx.fillRect(items[k].split(" ")[0], items[k].split(" ")[1], 60, 50);
        }
      }
      
      function jump() {
        if(g = g) {
          if(!on)
            g=-142;
          try {
            clearInterval(cle);
            cle = setInterval(()=>{
              if(!on)
                g+=25;
              else
                guy = guy.split(" ")[0] + " " + (parseInt(items[0].split(" ")[1])-50);
              if(!on)
                guy=guy.split(" ")[0] + " " + (parseInt(guy.split(" ")[1])+g);
              draw(items);
            }, 200);
          } catch(e) {}
        }
        
        if(parseInt(guy.split(" ")[1])>400){
          on = false;
          guy=guy.split(" ")[0] + " " + 400;
        }
      }
      
      function createPodium() {
        try {
          var item = null;
       
          item=getPodium(items);
          if(items.length > i) {
            items[i] = item;
     
            var arr = items[i].split( " " );
            items[i] = (parseInt(arr[0])+20) + " " + arr[1];
            i++;
          }
          
          if(readyTimeTo) {
            incY();
            i = 0;
            readyTimeTo = false;
          }
      
          z++;
          if(z== 10) {
            z=0; readyTimeTo = true;
          }
        } catch(e) {

        }
      }
      
      let d = 0;
      
      function refreshEverything() {
        d++;
        if(d == 10) {
          points-=2;
          d = 0;
        }
        if(points<0)
          window.location.href="jump";
      }
      
      function game_addEventHandler() {
        canv.addEventListener('click', function(event) {
          if(on)
            f = false;
          else 
            f=true;
          on=false;
          if(!f)
            points+=20;
          jump();
        });
      }
      
      game_addEventHandler();
      
      function doSimplePointShow() {
        switch(points) {
          case -1:
            points = 0;
          case -2:
            points = 0;
          case -3:
            points = 0;
        }
        ctx.fillStyle="black";
        ctx.font = "70px Arial";
        ctx.fillText(points, 100, 100);
        ctx.font = "20px Arial";
        ctx.fillText("keep > 0 to stay", 50, 200);
      }
      
      function writeOut(writing) {
         ctx.fillText(writing + "!", 100, 30);
      }
      
      function changeBackgroundByScore() {
        var num = 888800+points;
        bgcolor = "#" + num;
        ctx.fillStyle="black";
        ctx.font = "20px Arial";
       
        var writing = "average";
       
        if(points > 100)
          writing = "above";
        if(points > 120)
          writing = "smartass";
        if(points > 140)
          writing = "gifted";
        if(points > 160)
          writing = "genius";
        if(points > 180)
          writing = "god";
        
        writeOut(writing);   
      }
      
      function checkForPodiumEvilTime() {
         if(podiumTime > 100) {
          podiumTime = 0;
          podiumEvil = !podiumEvil;
        }
      }
      function setPodiumBackground() {
         if(podiumEvil)
          podiumBgcolor = "red";
        else
          podiumBgcolor = "black";
      }
      function increasePodiumTime() {
        podiumTime++;
      }
      function refreshPointsByPodiumCondition() {
        if(podiumEvil && on)
          points -= 1;
        else if(on)
          points += 1;
      }
      function checkForEvilPodium() {
        increasePodiumTime();
        checkForPodiumEvilTime();
        setPodiumBackground();
        refreshPointsByPodiumCondition();
      }
      
      function runHtmlChores() {
        setInterval(()=>{
          cls();
          createPodium(); 
          checkForEvilPodium();
          doSimplePointShow();
         changeBackgroundByScore();
          refreshEverything();
        },100);
      }
      runHtmlChores();
      
    </script>