排序列表并写一些英语!


98

您的老板设法阅读了隐藏的秘密信息。但是,他最终并没有解雇您,只是让您担任秘书,并禁止您编写代码。

但是你是一个程序员。您需要编写代码。您必须编码。

因此,您的代码需要看起来与英语尽可能相似,有意义,并且看起来与代码尽可能少。您的代码应采用整数列表(在函数或STDIN中),并返回排序后的列表(将其返回或STDOUT)。

可以使用任何语言,但是我正在寻找最具创意的解决方案(如果您的代码看起来像是商务信函,则表示敬意)。

这是一次人气比赛!


14
空白救助?
kaine 2014年

19
SPL
丹尼斯

4
我也想到过SPL,但Chef也可能很有趣:P
Adriweb

@丹尼斯这几乎是不可能的。
Isiah Meadows 2014年

有趣的..还没有红宝石作品!:P
Gaurav Agarwal 2014年

Answers:


161

高尔夫脚本

亲爱的老板人。

我注意到我的键盘需要更换。写
符号〜$` 所需的键。和}不能正常运行。

这样的工作非常困难!请指示IT部门尽快更换有故障的
键盘。

真诚的

丹尼斯

在线尝试!

这个怎么运作

  • 未定义的标记(例如,大多数英语单词)是GolfScript中的noop。

  • . ; 复制输入字符串并丢弃副本。

  • ~ $ 计算输入字符串并对排序后的数组进行排序。

  • ` 检查阵列(用于漂亮的打印)。

  • . and 复制输出字符串并丢弃副本。

  • }是无与伦比的“超级评论”;之后的所有内容都会被忽略。


111
我猜您是在其他键盘上写的吗?
Geobits 2014年

13
也许他用隐藏在可访问性gaboodle中的鼠标键盘来编写它?
Tally 2014年

46
这是一个内联注释...这是一个块注释...这是一个超级注释!
门把手

9
@Geobits:假设“运行不正常”表示“需要多次尝试才能最终将字符显示在屏幕上”
justhalf 2014年

或者他使用了角色地图。
dan04 2014年

110

的PHP

定义一个函数item,该函数将对传递的数组进行排序。

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   \\
   //-----------------------\\

如果将其粘贴到文本编辑器中并调整窗口大小,这样看起来会好得多,这样您就可以一次在屏幕上看到整个内容。


118
“我已经成功地发现了所有括号。” 有人要去当月的员工!
Martin Ender 2014年

20
-1:您错过了«和»。(严重性为+1。)
凯文(Kevin

4
哇!:D不能停止笑
2014年

70

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)

''''''''''''''''''

44
+1喜欢您悄悄说出def“电话键3上的字母”的意思。
AJMansfield 2014年

68

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?

找到正确的单词是一个真正的痛苦。

输入:[1,7,4,3]
输出:[1,3,4,7]


48
看起来像是我从奈及利亚收到的电子邮件
克里斯·西里菲斯

6
@ChrisCirefice好吧,这些邮件也可能包含隐藏的代码;)我的代码中的间距和措辞有些差,是因为exec之后字符串的每15个字符形成一个新字符串,然后执行该字符串。所以整个程序基本上是exec"y=input();y.sort();print y"
Markuz

1
'''令人遗憾的是,顶部的多行字符串是一个死掉的礼物,但是“从现在开始严格执行'; exec''执行您的命令”为+1。和努力:p
Thomas

60

网志

To Manager [IT]

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

随着缩进和大小写的更改,代码变得更清晰。这定义了一个函数manager,该函数将列表作为输入并打印排序的列表。

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

to the
end

7
绝对看起来不像代码。
丹尼斯

1
我很喜欢这个。
弥敦道·美林

59

C

通过STDIN输入为空格列表,通过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

应使用以下命令进行编译:

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'

该代码扩展为:

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];
}

41
+1滥用预处理程序。当然,通过这种事情,您可以说使它看起来像您想要的任何代码一样。
蓬松的2014年

12
您应该给关键字和变量赋予含义,并且仅将预处理器用于大括号之类的特殊字符。你甚至都没有努力。
贝贝2014年

3
@bebe滥用行为越野蛮,恕我直言:)。

9
下一个代码高尔夫球将使此“源”编译为Conway的《生命游戏》的实现。-D高尔夫球!
slebetman 2014年

2
@fluffy我喜欢混淆C中的预处理程序滥用。您可以使用足够的#define/ -Ds 在有效的C代码中制作几乎所有内容。
Isiah Meadows 2014年

24

Python 2和3

不幸的是,今天的员工无法停止在各处使用标签。

#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

[我猜值得尝试吗?]


20
使用注释的绝佳借口,但不幸的是它包含实际代码

在末尾添加打印“ hello”
Anthony Pham

17

脑干

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

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

Pretty cool huh?

版权说明:

注意:我从这里复制粘贴它据我所知,该站点的代码均具有版权归CC by-sa 3.0所有,并注明出处。如果此方法不合法,请告知我,我将尝试删除它。


4
“您的代码需要看起来尽可能少的代码。”
肖恩·拉瑟姆

27
这是用于加密的公共密钥!没有代码!不同!
Realdeo 2014年

2
@Realdeo不要忘记了,程序运行后第二行将读取更多输入
自豪的haskeller 2014年

接得好!编辑它
Realdeo 2014年

4
使用Brainfuck,只需将代码合并到纯文本中应该会容易得多。>例如可以用于引号(这就是它在电子邮件中的工作方式)等等。
IngoBürk2014年

16

的JavaScript

我不确定我是否能胜过他,但我可以甩开他!

/*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 }); }


15
评论滥用有点使这一点更加明显。
Isiah Meadows 2014年

14

总督

基本上是英语,对不对?

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

转换为:

// oooot! my keyybr oad is brokn. i ne ed neew 1. 
function fixs(keys) {
    keys.sort();
    return keys;
}

15
我认为,如果您这样写,您的老板会解雇您的...
TuxCrafting,2016年

10

实时脚本

尝试弄清楚这一点……一直向他发送这样的电子邮件,以便进行更轻松,更通用的复制粘贴。

# 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.其标准库Prelude.ls具有本机排序功能。
2.注意两个遗漏的哈希(注释)。第一个比第二个明显得多。

它解析为:“ fun = sort”,并编译为:“ var fun; fun = sort;”


顺便说一句,语法荧光笔是失败的。注释之一未正确解析。
伊赛亚·梅多斯

10

绕道(非竞争;-;)

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!

口译员永久链接

这个怎么运作:

唯一重要的部分是://,以及其上方的线z.:表示“将输入放在此处”,第一个将其/反映到z,这是排序;然后,它上升,环绕顶部,继续从底部上升,然后/从下方开始命中,然后 将其向左弹跳,另一个/则执行相同的操作,除了这次环绕到 .或输出。

简化版:

车辆改道

Dear Boss Man             
             z.
            ://

在线尝试!


5

JavaScript(ES6)

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

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

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

      /*( NO SMOKING IN OFFICE */)

在线尝试!

是的,我知道老板喜欢在他的公告中喜欢精美的装饰,所以我将文字大写并用精美的符号将文字围起来:)

PS。为什么办公室仍在使用TELNET?

实际上,删除注释和多余的空格会使这些东西变成(a)=>(a).sort(($,_)=>($-_)),这就是这些东西的意图; P


3

√奥ÏØ¿

我只是略过了另一个答案,但我仍然认为到目前为止,我是最好的(不是所有人)。

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

2

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'

13
您不应该编写代码。那是代码。
Zach Mertes 2014年

7
我很喜欢这个。它只是将代码隐藏在可见的地方。

4
大声笑,您应该输入“我已经找到Excel公式”。尽管我对Excel相当熟悉,但该参考从来没有动过我的脑海。

5
@kuroineko Excel公式没有这样的编程语法,对吗?
小孩

3
8个赞成票和9个反对票?哇; 这是有争议的。
Ypnypn 2014年

2

05AB1E

Dear Boss‚

I hope I{qualify for this new function. I once again want to sincerely apologize for my earlier secret message.
Thank you for giving me the opportunity to work at this apartment instead.
I must admit it's hard to resist the urge to write code, but I'll do my best.

Thank you.

Kind regards from your new secretary,
Kevin Cruijssen

在线尝试。(TIO使用的旧版本要快一些。不过,其工作原理与新的05AB1E版本相同。)

说明:

05AB1E代码将忽略字符串或压缩的字符串/数字之外的换行符和空格(使用我先前在制作此程序的尝试中发现的(if-)else语句时除外。..>),所以我们做同样的事情在这个解释中。

DearBossIhope # These are all no-ops; they do execute, but won't affect the output:
D              #  Duplicates the (implicit) input-list
 e             #  Calculates the number of permutations of each item in the list
               #  (NOTE: this might time-out depending on the values in the input-list)
  a            #  Check if these numbers are letters (becomes a list of 0s / falsey values)
   r           #  Reverse the items on the stack
    B          #  Base conversion
     o         #  Raise 2 to the power of each number
      s        #  Swap the top two items on the stack
       s       #  Swap the top two items on the stack
              #  Pair the top two items
               #  (NOTE: This is not a regular comma (,), since that would print the top of
               #   the stack to STDOUT, which we of course don't want here.)
         I     #  Push the input-list again
          h    #  Convert each value to hexadecimal
           o   #  Raise 2 to the power of each integer value
            p  #  Check for each if it's a prime
             e #  Calculate the number of permutations of each item again

I{q            # Then the actual program comes:
I              #  Push the input-list
 {             #  Sort it
  q            #  Stop the program
               #   This makes everything that comes after it no-ops
               #   And will output the top of the stack implicitly as result

在线尝试使用添加的调试器模式,以查看所有这些操作。


1
+1是自然的。
高度放射性的

1

sh

我不知道代码或创意写作是否更难。

: RE: The state of the evaluation process; eval `#problems'

: While I appreciate your enthusiasm, going to `print `
: this for the world to see isn't helpful in the long run.
: Please, don't make any more enemies than you already have.
:
: > People seem to just want that `'$'`: It's a big problem
: > which needs to be resolved. People need to buy into the
: > company's team-based philosophy `'{'`: ... ''}''
:
: While I do not deny that people "just want that '$'",
: I absolutely disagree that it's a _bad_ thing. Employees
: should not be guilty for wanting to leave for greener
: pastures, so you should try and provide _some_ incentive
: to stay.
:
: > And yet everyone want's to just check "(y)" or `'(n)'`
: > without giving _any_ further feedback... You're too LAZY!
:
: I want to stop you here. Accusations like this against my
: team are _not_ to be tolerated. We do a _lot_ behind the 
: scenes which you _clearly_ aren't aware of. Please refrain
: from `'@-ing'' any of my team, and think with a bit more
: empathy next time, thank you.

-- Gamma :-}'

在线尝试!

  • 注意:这将在运行目录中创建名为“ People”和“ without”的文件。

  • 在第一行,您可以看到eval,然后是反引号。

  • # comments继续到行尾,停止引用或反引号被解决,因此我们使用:无操作缩进。

  • 我们在整个过程中使用的标准模式是 `: lots of filler text.... : more filler text, then an important `'X'` : back to the garbage

  • 在最后一种情况例外:从一切@-ing到最后}是不是没有op'd。

  • 替换完成后,它显示为:eval print $'${(n)@-ing any of my team, and think with a bit more\n: empathy next time, thank you.\n\n-- Gamma :-}'后面的垃圾@没有执行任何操作,因此等效于print ${(n)@},它只是参数的数字排序。



0

JavaScript(Node.js)

Attachment => (

`Date: 2019/5/30

Dear my Majestic Boss,

Re: Business Trip to Japan

I'm writing to confirm itinerary for the next trip to Japan will be as follows:

`? (Tennoji, Osaka) => ("Shinsaibashi Tower", Osaka)

|| // Day 1

Tennoji [Osaka, "sort"] 
(Hotel = (JPY$14112, Taxed) => `So I will stay here for one night, and I will be charged this price:

`? JPY$14112 + (0 - Taxed) 
:`This is the total price and what I will claim afterwards.`

):0) (Attachment)

|| // Day 2

"Shinsaibashi Tower" [Conference, `NOT FOR SHOPPING`]

`I will be coming back on Day 2, so the trip will not cost too much hopefully.

Best regards,
The-former-programmer`

在线尝试!

好吧,这显然是一个行程。一年后,另一个方向不同的答案。

真正重要的部分是 Attachment => (Tennoji => Tennoji["sort"]((JPY$14112, Taxed) => JPY$14112 - Taxed))(Attachment)


-1

C#

//亲爱的老板人,

/*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
我的上帝,这真是让人难以理解……
Beta Decay

12
看起来太乱了。
Isiah Meadows

2
明显的注释:)第一行显示public List <String>,没有很多麻烦:)
Martijn 2014年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.