How to resolve the algorithm Sierpinski pentagon step by step in the Action! programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Sierpinski pentagon step by step in the Action! programming language

Table of Contents

Problem Statement

Produce a graphical or ASCII-art representation of a Sierpinski pentagon (aka a Pentaflake) of order 5. Your code should also be able to correctly generate representations of lower orders: 1 to 4.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Sierpinski pentagon step by step in the Action! programming language

Source code in the action! programming language

PROC Main()
  INT ARRAY xs=[249 200 96 80 175]
  BYTE ARRAY ys=[82 176 159 55 7]
  INT x,y
  BYTE i,CH=$02FC,COLOR1=$02C5,COLOR2=$02C6

  Graphics(8+16)
  Color=1
  COLOR1=$0C
  COLOR2=$02

  x=160+Rand(30)
  y=96+Rand(30)
  DO
    i=Rand(5)
    x=x+(xs(i)-x)*62/100
	y=y+(ys(i)-y)*62/100
    Plot(x,y)
  UNTIL CH#$FF
  OD
  CH=$FF
RETURN

  

You may also check:How to resolve the algorithm Averages/Pythagorean means step by step in the Delphi programming language
You may also check:How to resolve the algorithm Array concatenation step by step in the Efene programming language
You may also check:How to resolve the algorithm Prime triangle step by step in the Perl programming language
You may also check:How to resolve the algorithm Taxicab numbers step by step in the PARI/GP programming language
You may also check:How to resolve the algorithm 99 bottles of beer step by step in the Wren programming language