Difference between revisions of "Assessment2021 09Hard"

From ProgZoo
Jump to navigation Jump to search
Line 12: Line 12:
}   
}   
</pre>
</pre>
<ans>
function drawFlag(ctx)
{
  function banner(x,y,cc1,cc2,n,sc1,sc2){
    ctx.translate(x,y);
    let sqw = 100/n;
    for(let i=0;i<n;i++){
      for(let j=0;j<n;j++){
        ctx.translate(i*sqw,j*sqw);
        if ((i+j)%2===0){
          ctx.fillStyle = cc1;
        }else{
          ctx.fillStyle = cc2;
        }
        ctx.fillRect(0,0,sqw,sqw);
        ctx.translate(-i*sqw,-j*sqw);
      }
    }
    ctx.beginPath();
    ctx.moveTo(0,100);
    ctx.lineTo(50,100);
    ctx.lineTo(50,250);
    ctx.lineTo(0,300);
    ctx.fillStyle=sc1;
    ctx.fill();
    ctx.beginPath();
    ctx.moveTo(100,100);
    ctx.lineTo(50,100);
    ctx.lineTo(50,250);
    ctx.lineTo(100,300);
    ctx.fillStyle=sc2;
    ctx.fill();
ctx.translate(-x,-y);
  }
  banner(4,4,'red','yellow',2,"red","white");
  banner(108,4,'blue','yellow',4,"white","blue");
  banner(212,4,'red','white',5,"white","red");
</ans>
</div>
</div>



Revision as of 10:38, 26 September 2021



Three Checks

  • 316 by 308

Three Checks
function drawFlag(ctx)
{
}  

<ans> function drawFlag(ctx) {

 function banner(x,y,cc1,cc2,n,sc1,sc2){
   ctx.translate(x,y);
   let sqw = 100/n;
   for(let i=0;i<n;i++){
     for(let j=0;j<n;j++){
       ctx.translate(i*sqw,j*sqw);
       if ((i+j)%2===0){
         ctx.fillStyle = cc1;
       }else{
         ctx.fillStyle = cc2;
       }
       ctx.fillRect(0,0,sqw,sqw);
       ctx.translate(-i*sqw,-j*sqw);
     }
   }
   ctx.beginPath();
   ctx.moveTo(0,100);
   ctx.lineTo(50,100);
   ctx.lineTo(50,250);
   ctx.lineTo(0,300);
   ctx.fillStyle=sc1;
   ctx.fill();
   ctx.beginPath();
   ctx.moveTo(100,100);
   ctx.lineTo(50,100);
   ctx.lineTo(50,250);
   ctx.lineTo(100,300);
   ctx.fillStyle=sc2;
   ctx.fill();

ctx.translate(-x,-y);

 }
 banner(4,4,'red','yellow',2,"red","white");
 banner(108,4,'blue','yellow',4,"white","blue");
 banner(212,4,'red','white',5,"white","red");

} </ans>

Circles

  • 300 by 300

Banner Circles.png

function drawFlag(ctx)
{
}  

TOTP 1

Size is 100 by 300

Banners TOTP1.png

function drawFlag(ctx)
{
}  

TOTP 2

  • 260 by 200

Banners TOTP2.png

function drawFlag(ctx)
{
}