How to resolve the algorithm Pentagram step by step in the Quackery programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Pentagram step by step in the Quackery programming language

Table of Contents

Problem Statement

A pentagram is a star polygon, consisting of a central pentagon of which each side forms the base of an isosceles triangle. The vertex of each triangle, a point of the star, is 36 degrees.

Draw (or print) a regular pentagram, in any orientation. Use a different color (or token) for stroke and fill, and background. For the fill it should be assumed that all points inside the triangles and the pentagon are inside the pentagram.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Pentagram step by step in the Quackery programming language

Source code in the quackery programming language

[ $ "turtleduck.qky" loadfile ] now!

[ [ 1 1 
    30 times 
       [ tuck + ] 
   swap join ] constant 
   do ]                is phi       (    --> n/d )

[ 5 times 
    [ 2dup walk
      1 5 turn 
      2dup walk
      3 5 turn ]
  2drop ]             is star      ( n/d -->     )
 
[ 5 times
    [ 2dup walk
      2 5 turn ]
  2drop ]             is pentagram ( n/d -->     ) 

turtle
' [ 79 126 229 ] fill [ 200 1 star ]
10 wide 
-1 10 turn
200 1 phi v* phi v* pentagram
1 10 turn

  

You may also check:How to resolve the algorithm Guess the number/With feedback (player) step by step in the AsciiDots programming language
You may also check:How to resolve the algorithm Terminal control/Hiding the cursor step by step in the Go programming language
You may also check:How to resolve the algorithm Special characters step by step in the PowerShell programming language
You may also check:How to resolve the algorithm Conditional structures step by step in the Verbexx programming language
You may also check:How to resolve the algorithm Order two numerical lists step by step in the Scala programming language