This is an ascii-art challenge where you will draw ascii-art showing a person "jumping" off the top of a building.
The building
Input given will be a group of rectangular buildings. You may assume buildings are not "stacked on top of each other", hence only one row of buildings. This is the standard format of a building:
-----
| |
| |
| |
| |
A row of buildings looks similar.
------
----- --------------| |
| | | || |
| |----| || |
| || || || |
| || || || |
You may choose to remove the duplicate |
between two buildings if you would like.
Yes, buildings may be taller than the ones on their lefts, but you may assume that all buildings have a nonzero height.
This group of buildings will be given as input, in addition to the building index, which can be 0-or-1-indexed. (please specify which in your answer.)
You can also take input as an array of building characteristics or two arrays of heights and widths.
The person
A person is represented by an o
. The person always starts on the right of the given building, and starts jumping immediately.
Jumping
To quote this article,
The greatest human leapers in the world are able to jump over a bar suspended nearly 8 feet off of the ground.
Since I go by meters, this is about 3 meters (actually about 2.5, but whatever.) The person will hence jump "diagonally" for 3 meters (lines) before starting to fall, after which the person will also fall diagonally until hitting the top of a building or the ground.
Each meter should be represented by another o
at the exact position.
Example
Example is 1-indexed.
Given the above row of buildings and the index 1
, this would be the trajectory:
o
o o
o o
o o ------
----- --------------| |
| | | || |
| |----| || |
| || || || |
| || || || |
The person started at the right of the first building, then there were 3 o
s going upwards before the o
s started trending downwards. The o's stopped the moment the person hit the third building.
Given index 3:
o
o o
o o
o------
----- --------------| |
| | | || |
| |----| || |
| || || || |
| || || || |
Note that the person cannot be stopped by the top of a building before completing his 3-meter initial jump.
Given index 4:
o
o o
o o
o o
------ o
----- --------------| | o
| | | || | o
| |----| || | o
| || || || | o
| || || || | o
The person stopped after hitting the ground.
Given index 2:
This particular case is impossible as the person is stopped by the wall of the following building. This brings another rule into the challenge: you are allowed to assume that there will never be impossible input, i.e. one where the person is stopped by another building's wall in the way, whether in his initial 3-meter jump or as he is coming down (the top of the building does not stop the person from jumping).
You are also permitted to use a character other than o
as long as it is none of |-
(note the trailing whitespace, you may not use whitespace to denote the person.)
Macrons are permitted (the ones which look like "overscores") and if you do use them you may count them as one byte. There will never be gaps between buildings.
This is code-golf, so the shortest answer in bytes wins with standard loopholes disallowed as usual.