# Mr. ASCII becoming uncanny with your own code

Let's make a little stupid program that simulates the meme "Mr. incredible becoming uncanny", but in this case, our little ASCII friend is going to react to our code length.

Objective:

Create a program that takes anything (preferably a program) as input and outputs this:

Pov:
<face>   you score X on codegolf


Where X is the length of the input and the face depends on the value of X:

X < 20         = \(^-^)/
20 ≤ X < 50    = -(o_o)-
50 ≤ X < 100   = /(¬_¬)\
100 ≤ X < 250  = /(º-º)\
250 ≤ X < 500  = /(ª@ª)\
X ≥ 500        = /(x_x)\


Example:

I have made my own ungolfed version in C#: Try it online!

using System;
class Program {
static void Main(string[] args) {
Console.WriteLine("Pov:");

if(args.Length < 20){
Console.WriteLine("\\(^-^)/   you score "+args.Length+" on codegolf");

}else if(args.Length < 50){
Console.WriteLine("-(o_o)-   you score "+args.Length+" on codegolf");

}else if(args.Length < 100){
Console.WriteLine("/(¬_¬)\\   you score "+args.Length+" on codegolf");

}else if(args.Length < 250){
Console.WriteLine("/(º-º)\\   you score "+args.Length+" on codegolf");

}else if(args.Length < 500){
Console.WriteLine("/(ª@ª)\\   you score "+args.Length+" on codegolf");

}else{
Console.WriteLine("/(x_x)\\   you score "+args.Length+" on codegolf");

}
}
}


If the program takes itself as input, it will output:

Pov:
/(x_x)\   you score 741 on codegolf


Rules:

• The output must have exactly three spaces betwen the face and the text.
• The shortest code in bytes wins.
• Input length should be counted in characters, not bytes.
• If we are to assume the input is always our own code, then we can just ignore the input, per consensus. At this point, the task is just to output one of these literal strings, and implementing the rest of the challenge becomes unobservable Jan 13, 2022 at 16:32
• @pxeger yep, just after write this a had left my house for some time and i was thinking in that xd, i am going to fix this Jan 13, 2022 at 17:05
• Length of the input is what exactly? Because usually string length is not the number of bytes. In fact it seems most answers here don't even score themselves accurately. Jan 13, 2022 at 21:31
• @WheatWizard its true, i hadnt realized that some characters count as 2 bytes, but lets say that the count of bytes from the output is more ¿"symbolic"? or easier idk, i am going to add a rule about that to leave it clear Jan 13, 2022 at 22:45
• @ZeroCodeException Still not fully clear. Characters as in bytes in the used charset, as in Unicode code points, as in Unicode grapheme clusters, or as in "whatever of these the language can output with the shortest code"? Jan 14, 2022 at 1:39

# Charcoal, 1061029694 85 bytes

ＰPov:ＤＰ✂⁺”|ecT#Ｆ>”xªº´¬o^_@--_-ΣＥＩ⪪”←⧴⟲º"Ｑ⪫+R” ‹Ｌθιφ⁶←‖Ｂ”↶±=⧴KＣX≕‹#”ＩＬθ”↶←∨^⁹⁰y↔]


Try it online! Link is to verbose version of code. Note that the deverbosifier miscalculates the length of characters in the ISO-8851 code page; non-ASCII characters should count 3 bytes instead of 1. Explanation:

ＰPov:Ｄ


Print Pov: without moving the cursor (so it gets overwritten below), and output that on its own line.

Ｐ✂⁺”|ecT#Ｆ>”xªº´¬o^_@--_-ΣＥＩ⪪”←⧴⟲º"Ｑ⪫+R” ‹Ｌθιφ⁶


Concatenate the compressed string ////-\(((((( with the incompressible string xªº¬o^_@--_- (Charcoal can only compress ASCII strings), slice that with a starting offset depending on how many of the numbers in the compressed string 500 250 100 50 20 are greater than the length of the input and a step of 6, and print without moving the cursor.

←‖Ｂ


Butterfly the canvas, leaving the cursor after the face.

”↶±=⧴KＣX≕‹#”


Print the compressed string  you score .

ＩＬθ


Print the length of the input as a string.

”↶←∨^⁹⁰y↔]


Print the compressed string  on codegolf.

• This does not output Pov: Jan 13, 2022 at 22:45
• @Makonede An almost identical fix ;-)
– Neil
Jan 14, 2022 at 0:19
• If you're scoring with a codepage you can only use characters in said codepage, which ªº¬ don't appear to be. Jan 17, 2022 at 6:48
• @emanresuA ¬ is in said code page. Charcoal also has a 3-byte encoding for characters with ordinals less than 16512, however as I mention the deverbosifier doesn't actually perform the encoding so I manually adjusted the byte count.
– Neil
Jan 17, 2022 at 8:20
• @emanresuA To clarify, the deverbosifier only automatically adjusts the byte count for characters with ordinals above 255.
– Neil
Jan 17, 2022 at 8:24

# Excel, 151 bytes

=LET(x,LEN(A1),"Pov:
"&IFS(x<20,"\(^-^)/",x<50,"-(o_o)-",x<100,"/(¬_¬)\",x<250,"/(º-º)\",x<500,"/(ª@ª)\",1,"/(x_x)\")&"   you score "&x&" on codegolf")


Input is in the cell A1. Output is wherever the formula is.

Everything I try that seems more clever than this simple approach ends up adding a few bytes.

# Python 3, 158 bytes

x=len(open(0).read())
print("Pov:\n"+r"////-\((((((xªº¬o^_@-__-xªº¬o^))))))\\\\-/"[sum(x<q*10for q in[2,5,10,25,50])::6],f"  you score {x} on codegolf")


Try it online!

-1 byte thanks to pxeger
-9 bytes thanks to Kateba

• 167 Jan 13, 2022 at 16:31
• Got it down to 158 Jan 13, 2022 at 19:31
• @Kateba oh, that's a nice trick Jan 13, 2022 at 20:28
• Interestingly this gives "152" as it's own score not 158. Jan 13, 2022 at 21:32
• @WheatWizard unless I've read the challenge specs wrong I believe this is intended since the scoring mechanism for this challenge is bytes, but the length of X should be given in character length and not true byte count. Jan 13, 2022 at 23:37

# Retina 0.8.2, 139 bytes

s.+
Pov:¶$.&$*_   you score $.& on codegolf _{500,} /(x_x)\ _{250,} /(ª@ª)\ _{100,} /(º-º)\ _{50,} /(¬_¬)\ _{20,} -(o_o)- _+ \(^-^)/  Try it online! Explanation: s.+ Pov:¶$.&$*_ you score$.& on codegolf


Get the length of the input and substitute it into the output string, plus also insert that many underscores for the face checking.

_{500,}
/(x_x)\
_{250,}
/(ª@ª)\
_{100,}
/(º-º)\
_{50,}
/(¬_¬)\
_{20,}
-(o_o)-
_+
\(^-^)/


Replace the underscores with the appropriate face.

• This does not output Pov: Jan 13, 2022 at 22:45
• @Makonede Whoops, overlooked that.
– Neil
Jan 14, 2022 at 0:17

# Zsh, 138 bytes

f='\(^-^)/-(o_o)-/(¬_¬)\/(º-º)\/(ª@ª)\/(x_x)\'
<<<"Pov:
${f:$[i=$#1/50+($#1>19),i>9?5:i>3?3+i/5:i]*7:7}   you score $#1 on codegolf"  Try it online! Fancy ternaries, let's go through them: i=$#1/50+($#1>19) # div by 50, add one if at least 20 i>9?5: # if i > 9, then$#1 was at least 500
i>3?3+i/5           # else if i > 3, then $# was between 100 and 500 :i # else i is correct  ${f:$[ ... ]*7:7} # string slice starting from$[ ]*7 of length 7
<<<"..${f:$[ ... ]*7:7}...$#1.." # substitute in string. Embedded newlines are fine  # Rust, 192 191 bytes |x:&str|print!("Pov: {} you score {} on codegolf",match x.len(){0..=19=>r"\(^-^)/",0..=49=>"-(o_o)-",0..=99=>r"/(¬_¬)\",0..=249=>r"/(º-º)\",0..=499=>r"/(ª@ª)\",_=>r"/(x_x)\"},x.len())  Try it online! -1 byte thanks to Aiden4 • You can save a few bytes with type hint when assigning the closure, and by outputting directly to stdout. Try it online! Jan 17, 2022 at 2:37 • @Aiden4 Thanks, I didn't even think about printing to stdout. But using a closure type hint outside the counted bytes feels to much like cheating for me :-) Jan 18, 2022 at 20:59 • FYI, it's standard practice for the rust users of the forum to use type hints when assigning the closures, so long as it coerces into a function pointer of the correct type. Jan 18, 2022 at 22:26 # 05AB1E, 118113112 80 bytes -32 thanks to Kevin Cruijssen. ’ƒËŠˆ’Ig•È¼Ÿò8Ãx°иšü•"(\^-)/-o_¬ºª@x"Åв6ä•Û³™•51вT*ÅΔIg›}èJ.º“Pov: ÿ €îŒÂ ÿ€‰ ÿ  Try it online! Beats all other answers. • Well, it used to beat all the other correct answers, but I think you'll find that's not true any more... – Neil Jan 14, 2022 at 0:20 • 87 bytes. Not sure why you do ’IO.‚Ø :€Ÿ’.E, just take the input as multi-line string and use I instead. I've also golfed the U5FXNè®›iNˆ]5ˆ¯н to ÅΔIg›}, and you can remove the ÀÀ by not starting the base-string with \. @Neil Now it's true again. ;) Jan 14, 2022 at 8:02 • 80 bytes by using the mirror builtin for halve the faces. Jan 14, 2022 at 9:25 • @KevinCruijssen Bah, and I had just found an 82-byte Charcoal golf... – Neil Jan 14, 2022 at 9:39 • (Actually 86 bytes because I'd miscounted. Although I did golf a further byte off.) – Neil Jan 14, 2022 at 9:47 # JavaScript (ES6), 155 bytes f=(s,i=0)=>[.4,1,2,5,10,n=s.length][i]*50>n?Pov:${"/-\\"[q=2>>i]}(${(c="^o¬ºªx"[i])+"-__-@_"[i]+c})${"\\-/"[q]}   you score ${n} on codegolf:f(s,i+1)  Try it online! # Jelly, 89 bytes “µð1|ż‘Ḥ‘>@LS‘ị“\-/“(“^oḄṾȥx“-__-@_‘ŒḄ‘6¦U7¦0ịxɗ€6a"ƊZỌ¤ L⁶;“£ṭṛẇṣLe“¦ŒɱṣṀ^Tż»jṭÇ“Pov:¶”;  A full program accepting a (Python formatted) string argument that prints the result. Try it online! Or see the test-suite. ### How? “...‘Ḥ‘>@LS‘ị“...‘ŒḄ‘6¦U7¦0ịxɗ€6a"ƊZỌ¤ - Helper: list of characters, X “...‘ - list of numbers = [9,24,49,124,249] Ḥ - double = [18,48,98,248,498] ‘ - increment = [19,49,99,249,499] >@L - length of X greater than? (vectorises) S - sum ‘ - increment -> our "face index" ¤ - nilad followed by link(s) as a nilad: “...‘ - list of lists of numbers ...the ordinals of the characters: "\-/", "(", "^o¬ºªx", "-__-@_" ŒḄ - bounce ...this appends: "^o¬ºªx", "(", "\-/" ‘6¦ - increment the sixth - 2nd "(" -> ")" U7¦ - reverse seventh - 2nd "\-/" -> "/-\" Ɗ - last three links as monad: 6 - literal six ɗ€ - for each - f(list, 6): 0ị - get the last one x - repeat it six times a" - zip with logical AND ...effectively extend the lists to length six using the rightmost ordinal. Z - transpose Ọ - convert the integers to characters ...a list of the faces ị - "face index" index into "faces" L⁶;“...»jṭÇ“Pov:¶”; - Main Link: list of characters, X L - length of X ⁶; - prefix with a space “...» - compressed list of strings = " you score", " on codegolf" j - join with the score Ç - call the helper link, above with X as the argument -> face ṭ - tack the face to the front “Pov:¶” - "Pov\n" ; - concatenate - implicit, smashing print  # C# (.NET 6), 190 $$\\cdots\$$ 172 170 bytes int l=args.Length;Console.Write($"Pov:\n{(l<20?"\\(^-^)/":l<50?"-(o_o)-":l<100?"/(¬_¬)\\":l<250?"/(º-º)\\":l<500?"/(ª@ª)\\":"/(x_x)\\")}   you score {l} on codegolf");


Golf of example code in OP

Passing the program text as the first command line argument outputs:

Pov:
/(º-º)\   you score 170 on codegolf


Works on .Net 6 but not on TIO.

# Vyxal, 88 bytes

Pov:
»ẆḞẏǒ×Ȯ<§Jṙ¾»»ƛḂ}Ṁ≥⌐\$ǍJ₄p∞wj»₁dτCτ6/»⋏∑ṗ»51τ₀*≬⁰L>ḟuJhiøM3λ• ßµ ꘍?L on ¬⋎»₅Wṅ


Try it Online!