New answers tagged

1

Ruby -p, 66 bytes Builds the "lowercase" and "uppercase" strings so that everything lines up, and connects them together to be passed into the tr function so it can do the proper conversions. l="\\-a-z0-9=[-];',./`" u='_A-Z)!@#$%^&*(+{|}:"<>?~' $_.tr!u+l,l+u Try it online!


2

x86-16, Geniune IBM PC/XT, 32 bytes 00000000: b800 f08e c0bf e5e8 b33a b174 a082 00f2 .........:.t.... 00000010: ae3a cb7f 02f7 db26 8a41 ffb4 0ecd 10c3 .:.....&.A...… Build with xxd -r. Unassembled listing: B8 F000 MOV AX, 0F000H ; BIOS segment address 8E C0 MOV ES, AX ; set thus to ES for SCASB BF E8E5 ...


1

C (gcc), 100 bytes char*strchrnul(),*s=")0@2^6&7*8(9\"'+=-_:;`~\0";f(c){c=s[strchrnul(s,c)-s^1]?:(c%127>32)<<4+c/64^c;} Similar to the Javascript strategy. I'd like to get rid of the extra parentheses but this is pretty good. Try it online!


1

JavaScript (Babel Node), 89 bytes console.log("rnbqkbnr\npppppppp\n"+`${'.'.repeat(8)}\n`.repeat(4)+"PPPPPPPP\nRNBQKBNR\n") Try it online!


1

Perl 5, 56 54 bytes printf'%08x%s'x64,map{0|2**32*abs sin,$_%8?$":$/}1..64 Saved 2 bytes thanks to @XCali Try it online!


2

05AB1E, 53 36 35 bytes .šžQžiмDœ•1ĀêŽƵÆ{çIΣeÿí‚Ð"pkālrÙ•è‡ -1 byte implicitly thanks to @Grimmy due to his comment. Try it online or verify all printable ASCII characters. NOTE: The TIO versions use the S•...•.I (builtin for the n'th permutation of a list) instead of œ•...•è (push all permutations of the string (extremely slow bottleneck for a string this ...


1

Pure Bash, 217 bytes P=printf\ a=`$P%x "'$1"` case $a in 3[ab])x=1;;2[27])x=5;;2[68]|3[79])x=17;;2a|38)x=18;;2b|3d)x=22;;29|30)x=25;;36|5e)x=104;;2d|32|40|5f)x=114;;20|7f)x=0;;60|7e)x=30;;[23]?)x=16;;[4-7]?)x=32 esac $P\\`$P%o $[0x$a^x]` Try it online! Just bash -- no Unix utilities. Input character is passed as an argument, and the output is on stdout. ...


1

Bash, 58 105 bytes Added 47 bytes to fix a bug kindly pointed out by Giuseppe. tr "[_}{0-9'=<>?;a-z|~\-\][)\!@#$%^&*(\"+,./:A-Z\\\`]" "[-\][)\!@#$%^&*(\"+,./:A-Z\\\`_}{0-9'=<>?;a-z|~]" Try it online!


1

Python 3.8, 64 bytes I've just started code-golfing, so I'm not very good at it. This is what I got. print('rnbqkbnr\n'+'p'*8+('\n'+'.'*8)*4+'\n'+'P'*8+'\nRNBQKBNR') Try it online


6

Retina 0.8.2, 34 bytes T`-~A-]d';-?/.+,:"(*&^%$#@!)}-_`Ro Try it online! Link includes test cases. Explanation: The T command is Retina's transliteration operation. Among its special characters are: `: Delimit the parts of the command -: Introduce a range (this suppresses the following special characters so d-o just means defghijklmno) _: Delete the ...


2

Perl 5 -p, 92 bytes s/[a-z{}|\\\][]/$&^$"/gei;y/0-9)!@#$%^&*(`~\-=_+';":,.\/<>?/)!@#$%^&*(0-9~`_+\-=":';<>?,.\// Try it online!


1

APL (Dyalog Extended), 60 bytesSBCS Anonymous tacit prefix function. -(,⊃⍨⍳-¯1*⍳)⍨('"''+=,<-_.>/?:;[{\|]}`~',∊')!@#$%^&*(',¨⎕D),- Try it online! - swap case (…), prepend the following:  ⎕D the digits  ')!@#$%^&*(',¨ prepend each of these characters to the corresponding digit  ∊ ϵnlist (flatten)  '"''+=,<-_.>/?:;[{\|]}`~', prepend ...


2

Jelly,  38  37 bytes “Æz⁶ɦG!€u<ʂCP]ƭƝ’œ?ØṖḟØB¤ḊØD;ṙ21,ƊyŒs A monadic Link accepting a list of characters which yields a list of characters. Try it online! How? Forms a mapping for non alphabetic characters, applies the translate atom, y, and then swaps case. “Æz⁶ɦG!€u<ʂCP]ƭƝ’œ?ØṖḟØB¤ḊØD;ṙ21,ƊyŒs - Link: list of characters, S “Æz⁶ɦG!€u&...


2

Python 3, 99 95 bytes Same strategy as @Arnauld's answer. -4 bytes thanks to @mypetlion lambda c,s=")0!1@2#3$4%5^6&7*8(9\"'+=,<-_.>/?:;[{\\|]}`~":[c.swapcase(),s[s.find(c)^1]][c in s] Try it online! Explanation s=")0!1@2#3$4%5^6&7*8(9\"'+=,<-_.>/?:;[{\\|]}`~" contains all pairs of special toggles. s[s.index(c)^1] gets the index of ...


8

JavaScript (Node.js),  110 ... 97  96 bytes c=>(s=")0@2^6&7*8(9\"'+=-_:;`~")[s.indexOf(c)^1]||(B=Buffer)([([n]=B(c),n%127>32)<<4+n/64^n])+'' Try it online! How? We use a lookup table for these pairs: ) ↔️ 0 @ ↔️ 2 ^ ↔️ 6 & ↔️ 7 * ↔️ 8 ( ↔️ 9 " ↔️ ' + ↔️ = - ↔️ _ : ↔️ ; ` ↔️ ~ For all other characters, we use the following ...


2

APL (Dyalog Extended), 86 bytesSBCS This solution has been out-golfed but is preserved due to being interesting for its sourcing of the data. Anonymous prefix lambda. Requires 0-based indexing (⎕IO←0). {⍵∊a←↑'[!-~]{2}'⎕S'&'↓⍉↑'\w\w...'⎕R(5⍴'')↓11 71↑30↓⎕FMT⌂notes.keyboards:a⌷⍨~@1⊃⍸⍵=a⋄⍵} Try it online! This works by extracting the character pairs ...


0

C (gcc), 15 bytes f(){puts("☺");} ☺ Try it online!


0

MineFriff, 5 bytes C1,o; Try it online! Simply: Treat the temp register as a character Add one to the register and push Output the top item and finish.


1

Burlesque, 45 bytes 9roJcp:SOm{Jpdjimup"x="**j_+}{-]j-]==}gb)wduN Try it online! I'm almost positive there're multiple cuts that can be made here, but I just can't get them... 9ro # Range [1,9] J # Duplicate cp # Cartesian product :SO # Filter for sorted-reversed m{ # Map J # Duplicate pd # Product jimup # Convert the ...


1

05AB1E, 22 20 bytes 9LεLyâε'×ý'=yPðJ6∍]» -2 bytes thanks to @Grimmy. Try it online. Explanation: 9L # Push a list in the range [1,9] ε # Map over each value `y`: L # Push a list in the range [1,y] yâ # Pair each value in this list with `y` # i.e. [1,2,3] and 3 → [[1,...


2

PowerShell, 54 52 bytes 1..9|%{''+(1..($l=$_)|%{"$_`×$l={0,-2}"-f($_*$l)})} Try it online!


1

chevron - 4 bytes/2 runes >☺


2

05AB1E, 121 117 112 110 109 bytes •S²c¾rƒã∞Øø”.ÑSZl›¹'•2в°T•2nZιć‹ε˜Órv†„₃}Z$+àFQ$•7в1.•®DÝ∍ÌoƵižÒƵaŒ•2ô.;.;6ÝIS¬ì:slƵ{ö•X»²ÄµÕΛεĀδkM•9ävy%}èÙ™ Try it online! or validate all test cases.


1

05AB1E, 21 bytes ". + "12Ýû€Dã€ßèJ50ô» Inspired by @Zgarb's J answer, so make sure to upvote him as well. Try it online. Explanation: 12Ý # Push a list in the range [0,12] û # Palindromize it: [12,11,10,...,2,1,0,1,2,...,10,11,12] €D # Duplicate each item in this list: [12,12,11,11,10,10,...] ...


2

Whitespace, 9 bytes Try it online! ssstl push 1 on stack tlss output char


0

Gol><>, 2 bytes 1H Try it online! Just for completeness. Push a single 1, print all the contents as characters and halt.


0

Stax, 21 bytes Using recursive's method in the walkthrough, I don't take credit for this. (I'm surprised that it still doesn't beat Dennis's 20 bytes!) åS╬╕ø┤╝Φûµ╡τ╓δR╚╦>«C▲ Run and debug it


0

W, 2 bytes After the chr function, this actually returns a smiley face! (Because W uses CP437) 1C A few more 2-byters: ☺" '☺


1

05AB1E, 2 characters Just a boring hard-coding. It's encoded in CP437. "☺ Try it online! 05AB1E, 2 bytes 1ç Try it online!


1

Keg, 2 characters Push the number 1 and print it. (Surprised that 1, also works; -1 from Lyxal.) 1, Try it online! Keg, 1 character Keg is actually Turing-complete, and any unrecognized command acts as a push onto the stack. ☺ Try it online!


1

Perl 5, 137 135 132 123 bytes for$i(0..24){$e=49-$i;map{$a[$_][$i]=$a[$_][$e]=$a[$i][$_]=$a[$e][$_]=substr'. + ',$i%8/2,1}$i..$e}print join'',@$_,$/for@a Try it online!


1

PowerShell, 90 75 69 bytes ($r=25..1+1..25)|%{$y=$_ -join($r|%{'.. ++ '[($_,$y)[$_-lt$y]%8]})} Try it online!


0

Stax, 27 bytes éeO├φ☻mRàzΦ╛`φ#2àáÿ²øΔ=L←§b Run and debug it Unpacked and Uncompressed A2#F~;3%z"Fizz"?;5%z"Buzz"?+cz=,a?P


1

Stax, 2 bytes 1] Run and debug it


0

W n d, 22 21 bytes Seems like nobody ties with Dennis (Jelly has a "magical hook" that makes the a operand unneccecary). ♥:jΓƒ¢D╦Γ%%lOvhI♣BAE§ Uncompressed: 3m!?SY%?*?SZ%?a5m!*+a|2^N Explanation 2^N For Each: 1 to 100 3m! Repeat whether current item is divisible by 3 ?SY%?* Repeat that bool ...


0

PowerShell, 5 bytes if a program should output the smile face char. '☺' Try it online! PowerShell, 7 bytes if a program should output the char with code 1. [char]1 Try it online!


1

Excel (Version 1911), 247 A1 =DEC2HEX(COLUMN(A1:P1)-1) A2 'Input String A3 =2+LEN(A2)/16 A4 =CONCAT(" ",C2#) A5 =TEXTJOIN(" "&REPT("+---",17)&"+ ",0,,"| "&MID(A4,B2#+1,1)&" | "&MID(TEXTJOIN(" | ",0,A1#,MID(A2&REPT(" ",16),HEX2DEC(C2#&A1#)+1,1)),B2#*64+1,61)&" |",) ' Output B2 =SEQUENCE(A3)-1 C2 =DEC2HEX(SEQUENCE(A3-1)-1) ...


0

Perl 5 -F, 134 bytes @F=(@a=($",0..9,A..F),@F,($")x(16-(@F%16||16)));shift@F;$,=" | ";say$:=" "."+---"x17 .'+';say+('| '.shift@a),(splice@F,0,16),$:while@F Try it online!


1

PowerShell, 127 126 121 bytes ($d='+---'*17+'+') ($n="0123456789ABCDEF$args"+' '*16)|sls '.{16}'-a|% m*|% v*|%{"$($n[$i++-1]+$_|% t*y|%{"| $_"}) |" $d} Try it online!


3

Java (JDK), 295709 47044 (gzipped file) + 943 (code) + 1 (file) + 67 (imports) = 48055 bytes Examining the file manually (with some help from notepad++), I found that there were 976 unique entries in the file, formed of 36 unique characters (plus newlines): #(),/123456789:ABCDEFGNXabdghijmnsu I then looked for common patterns, and created a dictionary as ...


1

05AB1E, 150 149 bytes `UV7*Y8÷6*xsYαƵΓYåi<6LXåDX«U_}X8+).•2!ÛÄÒÁw§#Kºγ‚¼8&òo£Ù0ÿM¾…hTвcтv›IÈΩ{т3)`pñ"O|BεÆõ¿-∍£¸±<¥Ð~„Ñzä₂-bζÅ'á`†^=/Rú÷hÕS»•#ÁsèõK…-ˆÆ ć‚R7L1«IåèýI_i"zéro Try it online! or validate all possible inputs Takes input 0-padded to length 3.


1

Python 3, 969 + 36208 (size of data file) = 37177 bytes A mix of encoding and traditional compression. I store each of the roots (the "letters") and index into an array to find them, then, if it's not N, X or the empty string (which don't have a "chord type" (combination of the quality and other stuff tacked on the end) and are immediately followed by a ...


0

Burlesque, 11 bytes 1e4qsoFO:U_ Equivalently 1e4ro:so:U_ Try it online! 1e4 # 10000 qso # Boxed is sorted? FO # Filter from 1..10000 if sorted :U_ # Filter for unique digits


1

Fortran (GFortran), 48 bytes print*,(acos(-1._16)**(1/real(i,16)),i=1,12) end Try it online! Just an implicit loop with quad-precision vars. Not transferable, but works with GCC.


2

Haskell, 86 bytes g(c,x)=replicate(floor$1+62*1.43**x)c++"." f="http://"++(zip['a'..][-25..0]>>=g)++"me" Try it online!


1

MATLAB 92 bytes b="";for i=1:26;b=b+repelem(char(96+i),floor(1+62*(10/7).^(i-26)))+".";end;"http://"+b+"me"


0

TI-BASIC (TI-84+), 1042 bytes "...


1

Ruby, 64 bytes Conveniently, when multiplying a string with a non-whole positive number, Ruby truncates the number to determine how many times to repeat the string. puts"http://#{(?a..?z).map{|c|c*(1+62/0.7**(c.ord-122))}*?.}.me" Try it online!


2

R, 124 115 63 bytes This is way better than my original approach. Thanks to @Giuseppe and @Grimmy cat("http://");cat(strrep(letters,1+62*.7^(25:0)),"me",sep=".") Try it online!


4

Java (JDK), 108 bytes v->{var s="HTTP://";for(char c=64,t;++c<91;s+=(""+c).repeat(t/=Math.pow(.7,c-90))+c+".")t=62;return s+"ME";} Try it online! Credits -4 bytes thanks to Kevin Cruijssen


Top 50 recent answers are included