How to resolve the algorithm Colour pinstripe/Display step by step in the M2000 Interpreter programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Colour pinstripe/Display step by step in the M2000 Interpreter programming language

Table of Contents

Problem Statement

The task is to create 1 pixel wide coloured vertical pinstripes with a sufficient number of pinstripes to span the entire width of the graphics display.

The pinstripes should either follow the system palette sequence,   or a sequence that includes: black,   red,   green,   blue,   magenta,   cyan,   yellow,   and   white:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Colour pinstripe/Display step by step in the M2000 Interpreter programming language

Source code in the m2000 programming language

Module Checkit {
      Window 16, 14000,12000;
      Module Pinstripe {
            Smooth off  ' use of GDI32
            Dim colors(0 to 7)
            Colors(0)=#000000,#FF0000, #00FF00, #0000FF, #FF00FF, #00FFFF, #FFFF00, #FFFFFF
            pixelsX=scale.x/twipsX
            pixelsY=scale.y/twipsY
            zoneheight=scale.y/4
            n=0
            Refresh 5000
            For i=1 to 4 {
                  move 0, (i-1)*zoneheight
                  pinw=i*twipsx
                  For j=1 to pixelsX/i {
                        Fill pinw, zoneheight, color(n)
                        Step  0, -zoneheight
                        n++:if n=8 then n=0
                  }
            }
            \\ now we make the refersh
            Refresh 100
      }
      \\ draw to console window
      \\ now we make a window and draw there
      Pinstripe
      Layer 32 {
            Window 12, 10000,10000
            Pinstripe
            Show
      }
      Declare Pinstripe Form
      Layer Pinstripe {
            Window 12, 10000,10000
            Pinstripe
            motion 2000, 2000
      }
      refresh 20
            Thread {
                 if control$="MAIN" then if mouse then player 32,  mousea.x, mousea.y
            } as anyvar interval 100
      
      Method Pinstripe, "Show", 1
      Threads Erase
      Layer 32 {Hide}
      Cls
}
Checkit

  

You may also check:How to resolve the algorithm Truncatable primes step by step in the Racket programming language
You may also check:How to resolve the algorithm Four is magic step by step in the Raku programming language
You may also check:How to resolve the algorithm Array length step by step in the Scala programming language
You may also check:How to resolve the algorithm Binary search step by step in the Zig programming language
You may also check:How to resolve the algorithm Pangram checker step by step in the Delphi programming language