5 kyu
Recursive ASCII Fractals
52skidd
Description:
Fractals are fun to code, so let's make some.
Your task is to write a function that recursively generates an ASCII fractal.
- The function will take a
list[str]
representing rows of a seed pattern and anint
number of iterations - The seed pattern will be a rectangle containing two types of characters,
*
and.
- Each new iteration, every
*
in the starting seed is replaced by a copy of the last iteration. - Empty space is filled with
.
Example for the seed pattern:
***
*.*
***
1st iteration:
***
*.*
***
2nd iteration:
*********
*.**.**.*
*********
***...***
*.*...*.*
***...***
*********
*.**.**.*
*********
3rd iteration:
***************************
*.**.**.**.**.**.**.**.**.*
***************************
***...******...******...***
*.*...*.**.*...*.**.*...*.*
***...******...******...***
***************************
*.**.**.**.**.**.**.**.**.*
***************************
*********.........*********
*.**.**.*.........*.**.**.*
*********.........*********
***...***.........***...***
*.*...*.*.........*.*...*.*
***...***.........***...***
*********.........*********
*.**.**.*.........*.**.**.*
*********.........*********
***************************
*.**.**.**.**.**.**.**.**.*
***************************
***...******...******...***
*.*...*.**.*...*.**.*...*.*
***...******...******...***
***************************
*.**.**.**.**.**.**.**.**.*
***************************
- Input patterns will always be rectangular.
- For values of i < 1 or seeds with rows that are all empty strings, return
[]
. - Your function will be tested on both fixed and random inputs.
Tests
- Your solution must be efficient, as random tests will be on up to 9x9 input seeds
- There are 60 random tests with a seed of size 2 x n (n ranges from 0-9 and there are 5 tests for each value of n, each having i ranging from 0-4)
- There are 25 random tests with seed n x n where n ranges from 5-9. i = 4
Mathematics
Algorithms
Geometry
ASCII Art
Performance
Similar Kata:
Stats:
Created | Nov 19, 2022 |
Published | Nov 19, 2022 |
Warriors Trained | 373 |
Total Skips | 8 |
Total Code Submissions | 435 |
Total Times Completed | 52 |
Python Completions | 52 |
Total Stars | 20 |
% of votes with a positive feedback rating | 95% of 20 |
Total "Very Satisfied" Votes | 18 |
Total "Somewhat Satisfied" Votes | 2 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 8 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |