How to resolve the algorithm Sierpinski triangle step by step in the Hoon programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Sierpinski triangle step by step in the Hoon programming language

Table of Contents

Problem Statement

Produce an ASCII representation of a Sierpinski triangle of order   N.

The Sierpinski triangle of order   4   should look like this:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Sierpinski triangle step by step in the Hoon programming language

Source code in the hoon programming language

|=  n=@ud
=+  m=0
=+  o=(reap 1 '*')
|^  ?:  =(m n)  o
    $(m +(m), o (weld top bot))
++  gap  (fil 3 (pow 2 m) ' ')
++  top  (turn o |=(l=@t (rap 3 gap l gap ~)))
++  bot  (turn o |=(l=@t (rap 3 l ' ' l ~)))
--

  

You may also check:How to resolve the algorithm Arrays step by step in the Gambas programming language
You may also check:How to resolve the algorithm Bell numbers step by step in the Groovy programming language
You may also check:How to resolve the algorithm Include a file step by step in the Lasso programming language
You may also check:How to resolve the algorithm Rename a file step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm Averages/Arithmetic mean step by step in the GEORGE programming language