Your boss managed to read the secret hidden message. He didn't end up firing you, though, he just made you a secretary and forbade you from writing code.

But you're a programmer. You need to write code. You must code.

Therefore, your code needs to look as similar to English as possible, make sense, and look as little like code as possible. Your code should take a list of integers (either in a function, or STDIN), and return that list sorted (returning it, or STDOUT).

Any language can be used, but I'm looking for the most creative solution, (kudos if your code looks like a business letter).

This is a popularity contest!

  • 13
    whitespace to the rescue? – kaine Sep 5 '14 at 19:26
  • 18
    Or SPL. – Dennis Sep 5 '14 at 20:06
  • 4
    I thought of SPL too, but Chef may be fun as well :P – Adriweb Sep 7 '14 at 0:12
  • @Dennis That would be nearly impossible to figure out. – Isiah Meadows Sep 8 '14 at 21:43
  • Funny.. there are no ruby submissions yet! :P – Gaurav Agarwal Sep 9 '14 at 8:22

16 Answers 16

GolfScript

Dear Boss Man.

It came to my attention that my keyboard needs replacement; the keys required to write the
symbols ~ $ ` . and } are not functioning properly.

It's very difficult to work like this! Please instruct the IT department to exchange the faulty
keyboard as soon as possible.

Sincerely,

Dennis

Try it online!

How it works

  • Undefined tokens (e.g., most English words) are noops in GolfScript.

  • . ; duplicates the input string and discards the copy.

  • ~ $ evaluates the input string and sorts the resulting array.

  • ` inspects the array (for pretty printing).

  • . and duplicates the output string and discards the copy.

  • } is a "super comment" since it is unmatched; everything following it is ignored.

  • 107
    I'm guessing you wrote this on your other keyboard? – Geobits Sep 5 '14 at 20:23
  • 11
    Perhaps he wrote it with the mouse keyboard hidden in the accessibility gaboodle? – Tally Sep 7 '14 at 19:34
  • 44
    It's an inline comment... it's a block comment... it's a SUPER-COMMENT! – Doorknob Sep 7 '14 at 19:55
  • 8
    @Geobits: Let's assume that "are not functioning properly" translates to "requires multiple attempts to eventually get the characters on the screen" – justhalf Sep 8 '14 at 1:37
  • Or he used Character Map. – dan04 Sep 9 '14 at 2:42

PHP

Defines a function called item that will sort an array that you pass it.

Dear Boss,
I have successfully discovered all brackets.
The ones marked with question marks are the ones which I am not sure about.
The ones marked with asterisks can be used both as an opening and closing delimiter.
(
)
{
}
[
]
>?
<?
/*
'*
"*

Thank you for reading my memo. In other news, the */ function item (#12 in the list of things that have an asterisk before them) was discovered recently, which I read on a local news site.
#12 is my favorite function item! Just thought you'd be interested. Sorry if this is too off-topic; here's some business stuff. Imagine that you had some (let's say you have a combination of $10
& $money) # of dollars (i.e. you have $10 + $money). Now, here's the important part. It's so important, I'll separate it from the rest of this message with the brackets I discovered:

{
#10 in my personal list of things to remember about money management is that you have to be careful. I still haven't been able to
sort #9 out yet (I bought the manual from someone else), but #9 also seems to be about being careful. You also have to guard the dollars
($money); #13 says that if you don't protect them by putting them in a bank or something, they might be stolen.
}

   //-----------------------\\
  //   Signed,               \\
  //   Your great employee   \\
   //-----------------------\\

It looks much better if you paste it into a text editor and resize the window so that you can see the entire thing on your screen at once.

  • 110
    "I have successfully discovered all brackets." Someone's going for employee of the month! – Martin Ender Sep 6 '14 at 0:19
  • 15
    -1: You missed « and ». (In seriousness, +1.) – Kevin Sep 6 '14 at 21:19
  • 3
    Wow man. :D Can't stop laughing – Ven Sep 8 '14 at 15:12

Python 2

'''
                        5th of September 2014

Dear Boss,

I  am writing    this Mail because     i want to discuss  
 the recent   incident.
I am Thankful    that you did not fire   me, and gave me a secretary position instead.
I dont have any    experience in being a     sec retary and I am not very. good at   writing mail,
so please   excuse any spelling,   grammar or   formating   errors  in     this mail.

I will       certainly     try to improve  and do   my best in my new job      and will'''
'from now on strictly ';exec'''ute your orders.   =
Firstly      i want to    sincerly        apologize my   dumb behaviour,it was  idiotic ( and childish ).
I   really  ;apologize  to you. it  wont  .happen again, sir. If   i   could  
 only   reverse   the  timeline       (to undo it all). Then i would;
I   really   promise to never  write  code in any form

Can i talk about that   in   a   meeting with  you?
  Maybe    today at'''[4::15]#in the afternoon?

Finding the right words was a real pain.

Input: [1,7,4,3]
Output: [1,3,4,7]

  • 46
    This looks like those emails I get from Nigeria lol – Chris Cirefice Sep 8 '14 at 4:49
  • 5
    @ChrisCirefice Well, these mails probably contain hidden code as well ;) The spacing and somewhat poor wording in my code is because every 15th character of the string after the exec forms a new string which is then executed. So the whole program is basically exec"y=input();y.sort();print y" – Markuz Sep 8 '14 at 12:45
  • 1
    The ''' multiline string at the top is a dead giveaway, sadly, but +1 for "from now on strictly ';exec'''ute your orders." and good effort :p – Thomas Sep 12 '14 at 10:47

Python 2

'''''''''''''''''''''''''''''''''''''''''''''
One of the phones in the office seems to be broken, so it needs to be fixed.

''''''''''''''''''''
This memo was made while testing the functionality of its buttons since
some of them didn't seem to work.
''''''''
1 (no alphabets) working with no problem
''''''''
abc working with no problem
'''''''''
def working (partially):
 please                                              =( 'o" :\
 at least I figured out that this was a problem!     :')
 # list (phone number list) was missing as well, so I need to:

 #1
 print (please, sorted (partially)) [1] # list, and [2] the memo
 #2
 return
 #3
 check (making-sure, ghi-jkl-etc. works)

''''''''''''''''''
  • 39
    +1 love how you snuck in def to mean 'the letters on phone key 3'. – AJMansfield Sep 6 '14 at 19:25

C

Input as space-separated list through STDIN, output as space-separated list through STDOUT.

Dear Boss, 

I have made for you a decision about my employment a t your company. At about noon 
a letter explaining this shall be presented to you, as I am a lazy person. As you 
are a fool, I will say no more. And I look forward to never seeing you again.

Insincerely, 
Steward Pitt

This should be compiled with:

gcc bossletter.c -o bossletter -Dam='+++' -Dwill='---' -Dthis='{' -Dhave=';' 
-Ddecision=',' -Dquit='*' -Dfor='(' -Dmy=')' -Dbrain='}' -Dlie=']' -Dnoon='-quit'
-DD='' -Dto='D' -Dyou='D' -Dfool='you' -Das='to' -Dday='D' -Dno='fool' -Dcake='Pitt'
-Dlook='you' -DPitt='the' -Dthe='as' -DBoss='a[9999 lie' -DAs='a have' -Dlazy='my' 
-Dperson='lazy have company' -Dyour='this' -DInsincerely='a' -Dcompany='b' 
-Demployment='int quit' -DDear='struct this employment a have brain b have' 
-Dbe='scanf for' -Dis='I[' -Dnever='for presented " " decision' -Dthat='4 decision' 
-Dagain="my have b" -Dt='decision quit about have' -Dshall='while for' 
-Dpresented='"%" to "d"' -Dletter='have brain' -DAt='a have return quit' 
-Dmore='have b' -DAnd='a have shall' -Dare='qsort for' -Dforward='--my printf' 
-Dexplaining='main for my' 
-Dsay='1 decision that made my day' 
-DSteward='Boss have no brain' 
-Dseeing='the cake is a lie'

The code expands to:

struct{ int *a; } b;
a[9999], I;
made(a, about) int *a, *about; {
    b.a;
    return *about - *a; 
}
main(){
    while(scanf("%d", I++ + a));
    b.a;
    qsort(a, I-- - 1, 4, made);
    b.a;
    while(I--) printf("%d ", I[a]);
    b.a, a[9999];
}
  • 38
    +1 for preprocessor abuse. Of course with that sort of thing you could arguably make it read like any piece of code you want. – fluffy Sep 6 '14 at 6:26
  • 11
    You should have given meaning to keywords and variables and only used the preprocessor for special characters like braces. You didn't even make an effort. – bebe Sep 6 '14 at 15:24
  • 3
    @bebe the more insolent the abuse, the better, IMHO :). – user16991 Sep 6 '14 at 19:52
  • 8
    Next codegolf is to make this "source" compile to an implementation of Conway's Game of Life. -D golf! – slebetman Sep 8 '14 at 8:12
  • 1
    @fluffy I love preprocessor abuse in obfuscated C. You can make almost anything in it valid C code with enough #define/-Ds. – Isiah Meadows Sep 8 '14 at 21:35

NetLogo

To Manager [IT]

Let Sue sort it; then
show Sue the end to the end

With indentation and capitalization changes, the code becomes clear(er). This defines a function called manager which takes a list as input and prints the list sorted.

to manager [IT]
  let sue sort IT; then (semicolons introduce a comment)
  show sue
  the
end

to the
end
  • 5
    Definitely doesn't look like code. – Dennis Sep 9 '14 at 17:40
  • I like this one a lot. – Nathan Merrill Sep 9 '14 at 18:11

Python 2 & 3

Unfortunately, the employees of today just can't stop using hashtags all over the place...

#WritingALetter #Business    Dear Boss,
#SecondLine    I found this scrap of paper on the floor. It said "

def sortl(l):        # define a function
    return sorted(l) # returns the list, sorted "

#ScrapOfPaper    Just thought I should let you know.
#Honesty    From Laurence

[Worth a try, I guess?]

  • 17
    Great excuse for using comments, but unfortunately it contains actual code – user16402 Sep 6 '14 at 15:15
  • Add print "hello" at the end – Anthony Pham Sep 16 '15 at 20:50

Brainfuck

Hey boss! This is the public key that you asked!

>,[[-[>>+<<-]>+>]<[<<]>,]+>[>+<-]>[>[>+<<->-]<[<<.>>-]<<[>>+<<-]>>+>>]

Pretty cool huh?

Copyright note:

Note: I copy pasted it from here. As far as I know, that codes from site are has copyright cc by-sa 3.0 with attribution. If this method is illegal, let me know and I will try to delete this.

  • 4
    "Your code needs to look as little as code as possible." – Sean Latham Sep 6 '14 at 9:03
  • 23
    It's a public key for encryption! Not code! Different! – Realdeo Sep 6 '14 at 9:03
  • 1
    @Realdeo Don't forget the , on the second line will read more input after the program ran – proud haskeller Sep 6 '14 at 9:19
  • Good catch! Editing it – Realdeo Sep 6 '14 at 9:21
  • 4
    With brainfuck it should be much easier to just incorporate the code in plain text. > for example can be used for quotes (that's how it works in emails) and so on. – Ingo Bürk Sep 6 '14 at 10:42

JavaScript

I'm not sure if I can outsmart him, but I can throw him off my trail!

/*Hello Bossman
I feel the need to alert you to a pressing matter.
Nothing Dan from Marketing's head seems to be */function/*ing anymore.
I have a lot of evidence, but not enough time to */sort/* through it.
Should I just send it to you directly */(/*although I'm sure you have about a thou*/s/*and other things to do*/)/*?
Nah, here's it in a summary:

Dan seems to be overly facinated by the */{/* key on his keyboard, and presses it many times a minute.
He */return/*ed his new Galaxy */s/*4, after trying to eat it, multiple times.*/.

/*When Dan was tasked to */sort/* through the Haberson account, he attempted to stab his computer multiple times with a ruler */(/*he was eventually deterred by Jenny)
Everyone backed off for a few days, but we all remembered.
Later, we approached him about the incident, he claimed hostile working conditions and that he was unable to */function(/*.
I think he m*/a/*y need to see a psychatrist.

None of us feel safe to approach him on the topic again*/, b/*rining up conflict is something most of us like to avoid. (except Jenny*/)
{/*Dan was then moved to a different spot in the building, in an attempt to give him a new environment.
Despite the move he */return/*ed to his old desk every day, and wrote */a - b/* on the walls of the new spot.
We all just sort of accepted that and the layout planner gave up after a week or two.

One week we got a new employee in the office. When she went to say Hi to Dan, he screamed a - b over and over.
Not sure what his fascination is there. b-c is a much superior algorithm.

We're not really sure what caused this, but one day he switched from the { key to the */}
/*key. Dan switched back the next day.

There is an ongoing betting pool on what will happen next (general categories mostly*/)
/*Currently the betting for him stabbing an actual person is at almost $20,000.

Please do something about Dan. If anything start a reality TV show from the security tapes.

On a completely unrelated note, I love this new */}/* key, it's really neat looking. Did my keyboard always have this?
Sincerely,
Zeke*/

function sort(s) { return s.sort(function(a,b) { return a-b }); }

  • 14
    Comment abuse kinda renders this more obvious. – Isiah Meadows Sep 8 '14 at 21:39

Dogescript

It's basically English, right?

shh oooot! my  keyybr oad is brokn. i ne ed neew 1.
such fixs much keys
keys dose sort
wow keys

translates to:

// oooot! my keyybr oad is brokn. i ne ed neew 1. 
function fixs(keys) {
    keys.sort();
    return keys;
}
  • 10
    I think your boss will fire you if you write like this... – TuxCopter Jul 16 '16 at 10:36

Detour (non-competing ;-; )

Dear Boss Man
I thought I had put your recovered files on drive z.
In reality it was downloaded to the main drive, C://users/boss/recovery. Sorry for the confusion!

Interpreter Permalink

How it works:

The only important part is ://, and the line above it, z.. : means "put input here", the first / reflects it up to z, which is sort; it then goes up, wraps across the top, keeps going up from the bottom, then hits / from below, which bounces it left to the other /, which does the same thing, except this time wrapping around to ., or output.

Simplified version:

Detour

Dear Boss Man             
             z.
            ://

Try it online!

LiveScript

Try figuring this one out...Been sending him emails like this the whole time to allow for easy, more versatile copy-paste.

# Mr. Boss,
#
#     So, I'm done with this job. It is driving
#     me crazy. We aren't allowed to have *any*
      fun =#(. I am planning on leaving this
#     company while you all poorly attempt to
#     sort all this out. Also, I would like to
#     mention that a specific single bit in the
       sort # for your in-house algorithm gets
#     inverted. Happy hunting while I have fun
#     programming for another company far more
#     grateful than yours.
#
# Best regards,
# Your handy little programmer-turned-secretary.

1. Its standard library, Prelude.ls, has a native sort function.
2. Note the two missing hashes (comments). The first is far more obvious than the second.

It parses as this: "fun = sort", and compiles to this: "var fun; fun = sort;"

  • By the way, the syntax highlighter is a fail. One of the comments isn't parsed correctly. – Isiah Meadows Sep 22 '14 at 22:01

√ å ı ¥ ® Ï Ø ¿

I have only skimmed the other answer but I still think mine is by far the best (don't we all). The only problem is that this language is non-competing as language post-dates the challenge.

isolate quickly! Then read this short story: Funny Steve Jobs
. A Short Story
 by This Guy. Steve Jobs looked at the heavy stone in his hands and felt annoyed. He walked over to the window and reflected on his sunny surroundings. He had always loved nice Silicon Valley with its huge, hurt houses. It was a place that encouraged his tendency to feel annoyed. Then he saw something in the distance, or rather someone. It was the figure of Bill Gates. Bill was a happy monster with young heads and old feet. Steve gulped. He glanced at his own reflection. He was a funny, irritating, beer drinker with skinny heads and ginger feet. His friends saw him as an abundant, average angel. Once, he had even made a cup of tea for an unusual old lady. But not even a funny person who had once made a cup of tea for an unusual old lady, was prepared for what Bill had in store today. The sun shone like coding dogs, making Steve violent. As Steve stepped outside and Bill came closer, he could see the anxious smile on his face. Bill glared with all the wrath of 9230 stupid healthy humans. He said, in hushed tones, "I hate you and I want money." Steve looked back, even more violent and still fingering the heavy stone. "Bill, you stole my idea," he replied. They looked at each other with angry feelings, like two creepy, curried cats challenging at a very sad party, which had jazz music playing in the background and two annoying uncles doing to the beat. Steve regarded Bill's young heads and old feet. "I feel the same way!" revealed Steve with a delighted grin. Bill looked sad, his emotions blushing like a charming, cheerful computer. Then Bill came inside for a nice drink of beer. THE END

JavaScript (ES6)

      (a) => /*----------*\ <= (a)
       |      Announcement      |
  .   (a)    \*----------*/    (a)   .

 sort (/* YOUR DOCUMENTS BEFORE 2/5 )*/

     ($,_) => /*--------*\ <= (_,$)
      |         Warnings         |
 //  (_-$)    \*--------*/    ($-_)  //

      /*( NO SMOKING IN OFFICE */)

Try it online!

Yes, I know the boss likes fancy decorations in his notices so I capitalized the texts and surrounded the texts with fancy symbols :)

PS. Why is the office still using TELNET?

Actually, removing comments and redundant blanks makes the stuff into (a)=>(a).sort(($,_)=>($-_)), and that's what the stuff intends ;P

Groovy

'Dear Bossman,
I finally found the formula to calculate the salary for the new employees.
In the salary software just enter the following:'
print "${(args.toList()*.toInteger()).sort()}"'
Sincerely,
Employee'
  • 12
    You're not supposed to be writing code. That's code. – Zach Mertes Sep 6 '14 at 6:56
  • 6
    I quite like this one. It's just hiding the code in plain sight. – user16991 Sep 6 '14 at 19:55
  • 3
    LOL you should put "I've found the Excel formula" then. Though I'm quite familiar with Excel, the reference never crossed my mind. – user16991 Sep 7 '14 at 9:30
  • 4
    @kuroineko Excel formulas dont have such a programmy syntax, do they? – Little Child Sep 7 '14 at 11:50
  • 3
    8 upvotes and 9 downvotes? Wow; this is controversial. – Ypnypn Sep 9 '14 at 0:14

C#

// Dear Boss Man,

/*i have a */public/*shed a*/ List /*of*/ <string>/*s
to*/ Sort /*for you on our internal website
please take a look at the */(List /*of*/ <string>/*s and*/ check){
/*them for company restrictions. please also */check /*the */.Sort();/*ing of the     list*/
/*furthermore could you please */return /*an email to me in which you state your */check/*ing state*/;}

// sincerely your slave Rob
  • 5
    My god that's hard to read... – Beta Decay Sep 8 '14 at 17:41
  • 11
    Looks too codey. – Isiah Meadows Sep 8 '14 at 21:41
  • 1
    Obvious comments :) The first line reads public List <String>, without a lot of hassle :) – Martijn Sep 9 '14 at 7:24

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.