How to resolve the algorithm Sierpinski carpet step by step in the Factor programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Sierpinski carpet step by step in the Factor programming language
Table of Contents
Problem Statement
Produce a graphical or ASCII-art representation of a Sierpinski carpet of order N.
For example, the Sierpinski carpet of order 3 should look like this: The use of the # character is not rigidly required for ASCII art. The important requirement is the placement of whitespace and non-whitespace characters.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Sierpinski carpet step by step in the Factor programming language
Source code in the factor programming language
USING: kernel math math.matrices prettyprint ;
: sierpinski ( n -- )
1 - { { 1 1 1 } { 1 0 1 } { 1 1 1 } } swap over [ kron ]
curry times [ 1 = "#" " " ? ] matrix-map simple-table. ;
3 sierpinski
You may also check:How to resolve the algorithm Phrase reversals step by step in the Elixir programming language
You may also check:How to resolve the algorithm 99 bottles of beer step by step in the Ruby programming language
You may also check:How to resolve the algorithm FTP step by step in the Lingo programming language
You may also check:How to resolve the algorithm Digital root step by step in the Scala programming language
You may also check:How to resolve the algorithm Currency step by step in the Quackery programming language