| Bytes | Lang | Time | Link |
|---|---|---|---|
| 044 | AWK | 250520T201049Z | xrs |
| 118 | Pascal | 230905T160000Z | Kai Burg |
| 015 | Vyxal j | 210618T092512Z | emanresu |
| 114 | 1+ | 200821T103929Z | Twilight |
| 061 | MAWP | 200821T092431Z | Razetime |
| 017 | Japt | 190128T172831Z | Oliver |
| 164 | BrainFlak | 190128T053510Z | MegaTom |
| 010 | Charcoal | 180731T143412Z | Kevin Cr |
| 026 | Noether | 180729T084828Z | Beta Dec |
| 036 | Python 2 | 150721T203423Z | Beta Dec |
| 2826 | PowerShell 5.1 | 180730T205214Z | Veskah |
| 031 | Excel | 180731T154456Z | Taylor R |
| 011 | 05AB1E | 180730T125545Z | Kevin Cr |
| 008 | Canvas | 180731T134128Z | dzaima |
| 169 | Whitespace | 180731T134617Z | Kevin Cr |
| 038 | PHP | 180731T124515Z | Titus |
| 050 | Befunge93 | 180731T111359Z | ItsJ0el |
| 036 | Kotlin | 180731T064438Z | snail_ |
| 038 | Ahead | 180730T030830Z | snail_ |
| 024 | Perl 5 | 180730T201617Z | Dom Hast |
| 037 | Java | 160802T074822Z | Kevin Cr |
| 015 | Pyke | 160805T201033Z | Blue |
| 2417 | PyMin | 160808T214239Z | acrolith |
| 028 | Neoscript | 160809T142038Z | TuxCraft |
| 042 | Ruby | 160910T073841Z | anna328p |
| 026 | Straw | 160909T204903Z | TuxCraft |
| 037 | Bash + coreutils | 160909T190248Z | seshouma |
| 046 | R | 160802T100950Z | Rudier |
| 054 | C | 160801T162822Z | owacoder |
| 030 | jq | 150722T110304Z | manatwor |
| 030 | Gema | 150722T111544Z | manatwor |
| 028 | sed | 150722T055018Z | Dennis |
| 038 | ><> | 150721T203054Z | Sp3000 |
| 036 | Julia | 150721T204136Z | Alex A. |
| 034 | JavaScript ES6 | 150721T203649Z | Downgoat |
| 016 | Pyth | 150721T202920Z | Maltysen |
| 060 | SWIProlog | 150721T203320Z | Fatalize |
| 042 | Snowman 0.2.0 | 150721T202910Z | Doorknob |
| 018 | CJam | 150721T202247Z | Optimize |
Pascal, 118 characters
Strings consist of char values.
The available char values beyond the bare minimum (i. e. necessary to write Pascal language elements) are implementation-defined.
Provided that all char values present are available in your implementation, you can write:
program p(input,output);var l:integer;begin
read(l);writeLn('🐬‥💦〜');for l:=1 to l do
writeLn(' ()');write('/__\')end.
Input:
4
Output (pun intended):
🐬‥💦〜
()
()
()
()
/__\
This lamp grants you a wish if you rub it. 😂
Vyxal j, 15 bytes
×d?(‛ ()‛/_WvøṀ
Example output:
****
()
()
()
()
/__\
I kinda golfed the shade.
×d # two asterisks
?( ) # Input times...
‛ ( # Push the two-char ` (`
‛/_ # Push the two-char `/_`
W # Push the entire stack
vøṀ # Ascii-art mirror each item.
1+, 114 bytes
11+""*+"*";";";;1.1##(A|11+""""**+;)"""*"**;""*""*+*";1+;"\"1+/<1+#(A)11+"*(|1+"1+")1+*+;1()"*"1+*++";;1()*"1+*+;
You all! Stop complaining about the length, this is the best I could do! Go blame Parcly Taxel for designing such a bowly language!
Shade is $$$$.
MAWP, 65 61 bytes
@95W2M!;2A!!;;2W2M;[25W;84W;85W!;1M;1A]25W;95W2M!;2W1M!!;;3A;
I'm sure it can be golfed by a few more bytes when displaying characters.
Brain-Flak, 164 bytes
({}<((((((((((()()){}()){})()){}()){}())){}()))[[]]()){({}<>)<>}<>>()){({}[()]<(((((((()()){}()){}){}){}())[()])[(()()()()){}])((()()()()()){})>)}(((({}{}{}{}{}))))
Output for 5:
{{{{
()
()
()
()
()
/__\
Charcoal, 16 12 10 bytes
8E⊕N(←_/‖M
-4 bytes thanks to @ASCII-only.
-1 byte thanks to @Neil by using a Map.
Try it online (verbose) or try it online (pure).
Uses 8()8 as cap, but the 8 can be any character from Charcoal's code-page that isn't used as a command/operator.
Explanation:
Print 8:
Print("8");
8
Print ( the input+1 amount of times downwards:
Print(Map(Incremented(InputNumber()), "("));
E⊕N(
Then after that print _/ in a left direction:
Print(:Left, "_/");
←_/
And finally mirror everything vertically:
ReflectMirror();
‖M
Python 2, 36 bytes
print"-"*4+"\n ()"*input()+"\n/__\\"
For input 4:
----
()
()
()
()
/__\
Note that for Python that any lamp shade using pipes is a byte less.
-1 bytes thanks to @Alex!
PowerShell 5.1, 28 26 Bytes
Thanks Mazzy for 2 bytes
8008;," ()"*"$args";"/__\"
Since the shade can be any 4 characters, using a number saves a pair of quotes. The hardest part was finding a nice looking shade.
Output:
PS C:\Users\ItsMe\Desktop> .\scratch.ps1 4
8008
()
()
()
()
/__\
Excel, 31 bytes
An anonymous worksheet function that takes input as a numeric from range [A1] and outputs to the calling cell.
This lamp is musical - and will help to liven and lighten up your day.
="/\
"&REPT(" ()
",A1)&"/__\"
Output
05AB1E, 17 15 13 11 bytes
„ (и„/_.ø)˜∞
-2 bytes (17 → 15) thanks to @EriktheOutgolfer.
-2 byte (13 → 11) after being inspired by @dzaima's Canvas answer.
Cap is the same as the base (/__\).
Explanation:
„ ( # Literal string " ("
и # Repeat " (" the input amount of times
# i.e. " (" and 3 → [' (',' (',' (']
„/_ # Literal string "/_"
.ø # Surround the list of " (" with "/_" on both ends
# i.e. [' (',' (',' ('] → ['/_',[' (',' (',' (',' ('],'/_']
˜ # Flatten this list
# i.e. ['/_',[' (',' (',' ('],'/_'] → ['/_',' (',' (',' (','/_']
∞ # Mirror each item
# i.e. ['/_',' (',' (',' (','/_'] → ['/__\',' () ',' () ',' () ','/__\']
# And output the list new-line delimited (implicitly due to the mirror)
Old 13 bytes answer:
„/_D„ (Iиs)˜∞
Canvas, 8 bytes
(×_¶/e⟳║
Explanation:
(× repeat "(" input times
_¶/e encase it on both sides in "_\n/"
the 1st line is surrounded in "_" and the second ends and starts with "/"
⟳ rotate the string clockwise without changing characters
║ palindromize horizontally with 0 overlap
Whitespace, 169 bytes
[S S S N
_Push_0][T N
T T _Read_STDIN_as_integer][S S S T S T T T S S N
_Push_92_\][S S S T S T T T T T N
_Push_95__][S N
S _Duplicate_95__][S S S T S T T T T N
_Push_47_/][N
S S N
_Create_Label_LOOP][S S S N
_Push_0][T T T _Retrieve_at_address_0][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate][S S S N
_Push_0][S N
T _Swap_top_two][T T S _Store_at_address_0][N
T T S N
_If_neg_Jump_to_Label_PRINT][S S S T S T S N
_Push_10_newline][S S S T S T S S T N
_Push_41_)][S S S T S T S S S N
_Push_40_(][S S S T S S S S S N
_Push_32_space][N
S N
N
_Jump_to_Label_LOOP][N
S S S N
_Create_Label_PRINT][S S S T S T S N
_Push_10_newline][S S S T S S S S T N
_Push_33_!][S N
S _Duplicate_33_!][S N
S _Duplicate_33_!][S N
S _Duplicate_33_!][N
S S T N
_Create_Label_LOOP_2][T N
S S _Print_as_character][N
S N
T N
_Jump_to_Label_LOOP_2]
Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
Try it online (with raw spaces, tabs and new-lines only).
Explanation in pseudo-code:
Pushes all characters in reversed order to the stack, and then prints them in a loop.
Integer i = STDIN as input
Push "\__/" to the stack
Start LOOP:
i = i - 1
if(i is negative):
Go to function PRINT
Push "\n)( " to the stack
Go to next iteration of LOOP
function PRINT:
Push "\n!!!!" to the stack
Start LOOP_2:
Print top as character to STDOUT
Go to next iteration of LOOP_2
NOTE: i in the pseudo-code above is stored back in the heap in every iteration of LOOP, because we don't want to leave it on the stack to be printed at the end.
PHP, 38 bytes
/--\<?while($argn--)echo"
()"?>
/__\
Save to file; run as pipe with -nF or try it online.
Befunge-93, 50 bytes
"\__/"&v
0-1_v#:<g00" ()"*25p0
*25$<>:#,_@#::::"_"
Example with Input 3
____
()
()
()
/__\
Ahead, 38 bytes
I"|MM|"Wr
~W" ()"oN<s!:-1~
@W"/__\"oN<
Samples
1
|MM|
()
/__\
2
|MM|
()
()
/__\
3
|MM|
()
()
()
/__\
Java 7 11, 84 83 37 bytes
n->"i!!i\n"+" ()\n".repeat(n)+"/__\\"
Try it online. (NOTE: Java 11 isn't supported on TIO yet, so String.repeat(int) has been emulated with repeat(String,int) for the same byte-count.)
Uses i!!i as cap. ¡!!¡ looks better, but is two bytes more.
Explanation:
n-> // Method with integer parameter and String return-type
"i!!i\n" // Return the cap + new-line
" ()\n".repeat(n) // appended with " ()" and a new-line `n` amount of times
"/__\\" // append with "/__\"
Pyke, 15 bytes
" ()"~mQAD"/__\
~m - 1000
" ()" - " ()"
QAD - duplicate(^) input times
"/__\ - "/__\"
Outputs:
1000
()
()
/__\
PyMin, 24 bytes / 17 characters
»ƒ+ѿ+" ø\n"*¬+ɓ+ѿ
Output for 5:
Fizz
()
()
()
()
()
Buzz
Shorter version with v0.5:
21 bytes / 13 characters
»ƒƜ+" ø¶"¯+ɓƜ
Neoscript, 28 bytes
{n|"[~~]
"+" ()
"*n+"/--\\"}
Ruby, 42 bytes
i=gets.to_i
puts "|--|\n#{" ()\n"*i}/__\\"
Straw, 26 bytes (non-competing)
<#~('--'
)>( ()
)-*>(/__\)>
Use '--' as lamp shade, take input in unary now in decimal
Bash + coreutils, 37 bytes
yes ' ()'|sed '1i####
'$1'{a/__\\
q}'
The newlines are necessary and counted in the bytes total. GNU sed is required.
Run:
./squiggly_lamp.sh 2
Output:
####
()
()
/__\
R, 54 52 46 bytes
cat("RRRR",rep(" ()",scan()),"/__\\",sep="\n")
In this version, input and output are almost mixed together :
{in/out}PUT :
> cat("RRRR",rep(" ()",scan()),"/__\\",sep="\n")
1: 4
2:
Read 1 item
RRRR
()
()
()
()
/__\
EDIT 1 : -2 bytes thanks to @manatwork comment.
EDIT 2 : -6 bytes. Full credit goes to @manatwork again
C, 54 bytes
Call f() with the desired height of the lamp.
f(n){for(puts("||||");n--;puts(" ()"));puts("/__\\");}
Example output for 5:
||||
()
()
()
()
()
/__\
jq: 30 characters
(29 characters code + 1 character command line option.)
8888,(range(.)|" ()"),"/__\\"
Sample run:
bash-4.3$ jq -r '8888,(range(.)|" ()"),"/__\\"' <<< 3
8888
()
()
()
/__\
On-line test (Passing -r through URL is not supported – check Raw Output yourself.)
Gema: 30 characters
*=gema\n@repeat{*;\ ()\n}/__\\
Sample run:
bash-4.3$ gema '*=gema\n@repeat{*;\ ()\n}/__\\' <<< 3
gema
()
()
()
/__\
sed, 28 bytes
s#.# ()\n#g
s#^\|$#/__\\\n#g
Takes input in unary. The shade is the obvious selection (same as the base).
Test run
$ echo -n 111 | sed -f lamp.sed
/__\
()
()
()
/__\
><>, 43 41 38 bytes
"\__/"aiv
"&-1v!?:<&a" ()
~"!_\
?!;o>l
Input via a code point, e.g. space is 32. This uses part of the program's own code as the lampshade, resulting in something that looks like a satellite dish:
~\_!
()
()
()
()
()
/__\
(Suggestion thanks to @randomra)
For three more bytes, we can change the third line to add a bit more customisation:
"\__/"aiv
"&-1v!?:<&a" ()
__\"\~"/
?!;o>l
This produces one of those lamps which shoot light upwards, for lack of a better way of putting it:
\__/
()
()
()
()
()
/__\
Julia, 36 bytes
n->print("|~~|\n"*" ()\n"^n*"/__\\")
This creates an unnamed function that takes an integer as input and prints to stdout.
Example:
julia> f(4)
|~~|
()
()
()
()
/__\
JavaScript ES6, 34 bytes
i=>`|==|
${` ()
`.repeat(i)}/__\\`
The newlines are significant
Example with input of 5:
|==|
()
()
()
()
()
/__\
Pyth - 16 bytes
Uses quotes for the shade since N is preinitialized to that.
*N4VQ+d`();"/__\
* 4 String repetition 4x, implicit print
N Preinitialized to Quote
VQ For N in range(Q)
+ String concat
d Space
`() Repr of empty tuple
; Close for loop
"/__\ Implicitly print string, implicit close quote
Sample for 5:
""""
()
()
()
()
()
/__\
SWI-Prolog, 73 60 bytes
a(X):-write(golf),writef("%r",["\n ()",X]),write("\n/__\\").
a(5). outputs
golf
()
()
()
()
()
/__\
Snowman 0.2.0, 42 chars
)vg10sB]"[--]
"sP:" ()
"sP;bR"/__"sP92wRsP
Sample run:
llama@llama:...Code/snowman/ppcg53483lamp$ snowman lamp.snowman
5
[--]
()
()
()
()
()
/__\
So I only noticed that I forgot to implement the ability to escape backslashes within strings when I solved this challenge. That's definitely going to be a thing in the next version, but for now, here's what I did to print the final line:
"/__"sP92wRsP
92 is the ASCII code for a backslash, wR wraps it in an array, and I can now print it with sP because "strings" in Snowman are actually just arrays of numbers.
CJam, 18 bytes
"/__\
"" ()
"ri*1$
Sample run for input 5:
/__\
()
()
()
()
()
/__\
