This script was made just for fun in my free time
- Generates all sort of pyramids including ones based on width, height, one sided and reverse ones
- Generates black hole containing symbols more dense towards center of black hole
- Generates tree with trunk and leaves more dense towards tree crown
- Python 3.9.4
-
Download repository
git clone https://github.com/goralczm/symbols-generators
-
OneSidePyramid(height, inverse=False, symbol='#') - prints rows containg number of 'symbol' in shape of one sided pyramid
- height - integer with pyramid height
- inverse - optional boolean variable, determines if pyramid should be printed inverse or not
- symbol - optional string variable, if not assigned- default value is hashtag ('#'), contains symbol which should be pyramid printed with
OneSidePyramid(3)
#
##
### -
PyramidBasedWidth(width, symbol='#', background=' ') - prints pyramid of given width
- width - integer with pyramid width
- symbol - optional string variable, if not assigned- default value is hashtag ('#'), contains symbol which should be pyramid printed with
- background - optional string variable, if not assigned- default value is space (' '), contains symbol which should be pyramids background printed with
PyramidBasedWidth(5, '&')
&
&&&
&&&&& -
PyramidBasedHeight(height, inverse=False, symbol='#', background=' ') - prints pyramid of given height
- height - integer with pyramid height
- inverse - optional boolean variable, determines if pyramid should be printed inverse or not
- symbol - optional string variable, if not assigned- default value is hashtag ('#'), contains symbol which should be pyramid printed with
- background - optional string variable, if not assigned- default value is space (' '), contains symbol which should be pyramids background printed with
PyramidBasedHeight(5, True, '%')
%%%%%%%%%
%%%%%%%
%%%%%
%%%
% -
BlackHole(width, height, density=4, tolerance=4, rejection=0, mode='diamond', offset=[0, 0], symbol='#', background=' ') - generates txt file containing generated black hole
- width - integer with black hole width
- height - integer with black hole height
- density - optional integer/float value, if not assigned- default value is 4, determines how dense black hole should be
- tolerance - optional integer/float value, if not assigned- default value is 4, determines how much of outer symbols should be generated
- rejection - optional integer value, if not assigned- default value is 0 (value of 0 means disabled, other bigger than 0 is enabled), determines percentage of how many symbols should not be generated
- mode='diamond' - optional string value (available are 'diamond' and 'circle'), if not assigned- default value is diamond, determines type of calculating distance from center for each 'pixel' from which is generating system based of
- offset - optional list value, if not assigned- default value is [0, 0], moves center of black hole 'offset[0]' 'pixels' left and 'offset[1]' 'pixels' top
- symbol - optional string variable, if not assigned- default value is hashtag ('#'), contains symbol which should be pyramid printed with
- background - optional string variable, if not assigned- default value is space (' '), contains symbol which should be pyramids background printed with
BlackHole(128, 128, 4, 3, 1, 'circle')
#output visible in 'black_hole.txt' file -
Tree(gridSize, density=4, tolerance=4, rejection=0, mode='diamond', symbol='#', background=' ') - generates txt file containig generated tree
- gridSize - integer with tree 'image' size
- density - optional integer/float value, if not assigned- default value is 4, determines how dense black hole should be
- tolerance - optional integer/float value, if not assigned- default value is 4, determines how much of outer symbols should be generated
- rejection - optional integer value, if not assigned- default value is 0 (value of 0 means disabled, other bigger than 0 is enabled), determines percentage of how many symbols should not be generated
- mode='diamond' - optional string value (available are 'diamond' and 'circle'), if not assigned- default value is diamond, determines type of calculating distance from center for each 'pixel' from which is generating system based of
- offset - optional list value, if not assigned- default value is [0, 0], moves center of black hole 'offset[0]' 'pixels' left and 'offset[1]' 'pixels' top
- symbol - optional string variable, if not assigned- default value is hashtag ('#'), contains symbol which should be pyramid printed with
- background - optional string variable, if not assigned- default value is space (' '), contains symbol which should be pyramids background printed with
Tree(128, 2, 3.5, 2, 'circle')
#output visible in 'tree.txt' file