33
2
I love sardines, I can't get enough of them, and so does my computer, the Omnilang 5000, which is language agnostic.
To give my computer the joy of experiencing sardines, I've decided to feed him a number of programs that are capable of displaying on the screen tins of sardines in various orientations, and showing up to ten sardines.
In this challenge, you'll be responsible for creating the programs based on these parameters:
The input
A number (between 0 and 10) and a letter from one of the following "LR" (representing Left or Right respectively)
For example: 3L
or 5R
; how this is input into the program is up to you.
Output
An open tin of sardines with the sardines facing the indicated direction, with the key (represented by the "%
" character) and peeled lid (rolled up tin at the end represented by the "@
" character) located at the top of the tin.
- All sardines must face the direction indicated by the input.
- All sardines will have bodies five characters long between the gill (either "
)
" or "(
" ) and the tail "><
" - The key and peeled lid roll will always be facing the opposite direction to the sardines.
- The tin must have a 3-D look to it as shown below in the examples.
- The minimum height of the tin is 3 sardines in height. So if a number is less than 3, a tin of 3 sardines in height must be shown, with the inputted number of sardines in it. Otherwise, the tin must be the number of sardines high indicated in the input. So input of
0R
or0L
will show an empty sardine tin. - Any other input that can't be validated will not show anything.
For example, for "3L
"
__________
(__________@%
|<*)_____><||
|<*)_____><||
|<*)_____><||
'==========''
For "7R
"
__________
%@__________)
||><_____(*>|
||><_____(*>|
||><_____(*>|
||><_____(*>|
||><_____(*>|
||><_____(*>|
||><_____(*>|
''=========='
For "2L
"
__________
(__________@%
|<*)_____><||
|<*)_____><||
| ||
'==========''
For "0R
"
__________
%@__________)
|| |
|| |
|| |
''=========='
"0L
"
__________
(__________@%
| ||
| ||
| ||
'==========''
Invalid input will not return anything...
- This is code golf, so the smallest number of characters will win this challenge.
- No Loopholes as per usual.
3Writing this solution in Fish is inspired... – WallyWest – 2017-07-30T06:00:07.750
How does the fish playground work? I can't get it to run. Where do I place the input? – JAD – 2017-07-31T08:51:07.237
@JarkoDubbeldam, after copying the code into the window and submitting it, you need to put the number of sardines where it says "initial stack" (simulating the
-v
flag), and the direction ("L" or "R") under "give input to the program" then click "give". (I've edited the answer to hopefully make that clearer.) – Not a tree – 2017-07-31T09:14:30.6901Awesome :D Must be nice during debugging too – JAD – 2017-07-31T09:19:55.793