6 kyu
Bus ASCII-Art Animation
Description:
What is an ASCII Art?
ASCII Art is art made of basic letters and symbols found in the ascii character set.
Example of ASCII Art (by Joan Stark)
_ _ / _
(')-=-(') __|_ {_}
__( " )__ |____| |(|
/ _/'-----'\_ \ | | |=|
___\\ \\ // //___ | | / \
(____)/_\---/_\(____) \____/ |.--|
|| |
|| | . ' .
|'--| ' \~~~/
'-=-' \~~~/ \_/
\_/ Y
Y _|_
_|_
Your Goal
Write a function that takes in:
- The size of the bus
- The speed of the bus
- The number of frames for the animation
- The size for how big a frame will be per line
The output should be a single multi-line string, each frame being seperated by frame size
number of dashes and a newline character.
How to Make the Bus
This is the base shape of the bus (when size = 1
):
_____________
| | | | \
|___|____|_|___\
| | | \
`--(o)(o)--(o)--'
With each increase in size, an additional middle section is added. Here are the example for size = 2
and size = 3
respectively:
__________________
| | | | | \
|___|____|____|_|___\
| | | \
`--(o)(o)-------(o)--'
_______________________
| | | | | | \
|___|____|____|____|_|___\
| | | \
`--(o)(o)------------(o)--'
How to Make the Animation
- Each iteration of the frames should make the bus "move forward" by
bus speed
spaces. - Each line of a frame should always be the size of
frame size
, if the generated frame is more narrow than that, fill the ends of the lines with spaces. If it is wider, cut the characters exceeding the frame's lines.
Technicalities
- Buses will never have a size less than 1
- Buses will never have a speed less than 0
- New line characters will not count as part of the
frame size
Solution Examples
Example #1
bus size = 1, bus speed = 2, frame count = 5, frame size = 20
_____________
| | | | \
|___|____|_|___\
| | | \
`--(o)(o)--(o)--'
--------------------
_____________
| | | | \
|___|____|_|___\
| | | \
`--(o)(o)--(o)--'
--------------------
_____________
| | | | \
|___|____|_|___\
| | |
`--(o)(o)--(o)--
--------------------
_____________
| | | |
|___|____|_|__
| | |
`--(o)(o)--(o)
--------------------
___________
| | | |
|___|____|_|
| | |
`--(o)(o)--(
Example #2
bus size = 3, bus speed = 5, frame count = 4, frame size = 35
_______________________
| | | | | | \
|___|____|____|____|_|___\
| | | \
`--(o)(o)------------(o)--'
-----------------------------------
_______________________
| | | | | | \
|___|____|____|____|_|___\
| | | \
`--(o)(o)------------(o)--'
-----------------------------------
_______________________
| | | | | | \
|___|____|____|____|_|___
| | |
`--(o)(o)------------(o)-
-----------------------------------
___________________
| | | | |
|___|____|____|____|
| |
`--(o)(o)-----------
Example #3
bus size = 2, bus speed = 0, frame count = 5, frame size = 25
__________________
| | | | | \
|___|____|____|_|___\
| | | \
`--(o)(o)-------(o)--'
-------------------------
__________________
| | | | | \
|___|____|____|_|___\
| | | \
`--(o)(o)-------(o)--'
-------------------------
__________________
| | | | | \
|___|____|____|_|___\
| | | \
`--(o)(o)-------(o)--'
-------------------------
__________________
| | | | | \
|___|____|____|_|___\
| | | \
`--(o)(o)-------(o)--'
-------------------------
__________________
| | | | | \
|___|____|____|_|___\
| | | \
`--(o)(o)-------(o)--'
ASCII Art
Puzzles
Similar Kata:
Stats:
Created | Jan 9, 2022 |
Published | Jan 9, 2022 |
Warriors Trained | 182 |
Total Skips | 3 |
Total Code Submissions | 284 |
Total Times Completed | 68 |
Python Completions | 68 |
Total Stars | 16 |
% of votes with a positive feedback rating | 92% of 24 |
Total "Very Satisfied" Votes | 20 |
Total "Somewhat Satisfied" Votes | 4 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 5 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 6 kyu |