创建一个魔术8球


34

小时候,我的朋友有一个神奇的8号球,我们会问这个问题,看看这个问题的命运是什么。

挑战

您面临的挑战是编写一个程序(或函数),在运行(或调用)时,从以下可能的答案中输出(或返回)随机答案。(随机为:each output should have a nonzero chance of occurring but they do not need to meet any other criteria

魔术8球的可能答案是(不区分大小写):

It is certain
It is decidedly so
Without a doubt
Yes definitely
You may rely on it
As I see it, yes
Most likely
Outlook good
Yep
Signs point to yes
Reply hazy try again
Ask again later
Better not tell you now
Cannot predict now
Concentrate and ask again
Don't count on it
My reply is no
My sources say no
Outlook not so good
Very doubtful

输入项

没有输入。

输出量

从上面随机选择。大小写无所谓。

规则

不允许出现标准漏洞

这是,因此每种语言的最短代码(以字节为单位)获胜!


2
我将“不允许输入”更改为“禁止输入”,某些语言要求使用空白/空参数作为输入。
Rɪᴋᴇʀ

12
是我还是某人正在拒绝所有答案????

1
@Dat我在meta中在此处发布了一些内容以讨论此问题。我已对每个答案都进行了投票,就像我一直为满足我的问题要求的答案所做的一样。也许一个主持人会干预...
DevelopingDeveloper

37
@DatSigns point to yes
mbomb007'3

1
@ mbomb007到目前为止,我在PPCG上看到的最喜欢的评论!
DevelopingDeveloper

Answers:


22

SOGL V0.12,166个字节

,▓a⁰²z○½℮ķčλ─fj[Ycψ-⁸jΔkÆΞu±⁄│(┼∞׀±q- υ~‼U/[DΓ▓νg⁸⅝╝┘¤δα~0-⁄⅝v⁄N⁷⁽╤oο[]āŗ=§№αU5$┌wΨgΘ°σΖ$d¦ƨ4Z∞▒²÷βΗ◄⁴Γ■!≤,A╬╤╬χpLΧ⁸⁽aIΘād⁵█↔‚\¶σΞlh³Ζ╤2rJ╚↓○sēχΘRψΙ±ιΗ@:┌Γ1⁷‘Ƨ! ΘlΨιw

在这里尝试!

\ o /每个单词都在SOGLs词典中!


这是一个了不起的答案!!!
DevelopingDeveloper

我很想看一下SOGL的压缩引擎,但不幸的是,我不会讲JavaScript :(
caird coinheringaahing

等等,SOGL是一种基于JavaScript的语言?
粗野的

@cairdcoinheringaahing SOGL是在Processing中编写的,相关的压缩文件在此处此处。尽管处理是一种基于Java的语言:p
dzaima

18

> <>,438个字节

x|o<"Yep"
x|^"Most likely"
x|^"Signs point to yes"
x|^"As I see it, yes"
x|^"Without a doubt"
x|^"Ask again later"
x|^"Don't count on it"
x|^"Cannot predict now"
x|^"Very doubtful"
x|^"My reply is no"
x|^"My sources say no"
x|^"Outlook not so good"
x|^"Reply hazy try again"
x|^"Better not tell you now"
x|^"Concentrate and ask again"
x|^"It's certain"
x|^"Outlook good"
x|^"Yes definitely"
x|^"You may rely on it"
x|^"It is decidedly so"

在线尝试!

没那么有趣,但是我认为这是随机性不一致的第一个答案。我把所有负面消息的可能性降到最低:)

一些解释:

指针从第一行开始向右移动。x将指针更改为随机的基本方向。如果它上升或下降,则只会遇到不同的情况x。如果操作正确,它会从弹起|并击中x。如果它走了,它会回绕并将该行的文本推入堆栈。然后,大多数线条沿同一^方向移动,从而将方向更改为向上。这会o在第一行上循环,这将输出堆栈直到清空。特殊情况是Yep线条,它具有水平循环|o<


7
我会用这个。它(几乎)总是给出积极的回应。不幸的是,答案也闻起来很腥...
Suppen

15

Python 2中,369个 368字节

print"It is certain.It is decidedly so.Without a doubt.Yes definitely.You may rely on it.As I see it, yes.Most likely.Outlook good.Yep.Signs point to yes.Reply hazy try again.Ask again later.Better not tell you now.Cannot predict now.Concentrate and ask again.Don't count on it.My reply is no.My sources say no.Outlook not so good.Very doubtful".split('.')[id(0)/7%20]

Python 3,371个字节

print("It is certain.It is decidedly so.Without a doubt.Yes definitely.You may rely on it.As I see it, yes.Most likely.Outlook good.Yep.Signs point to yes.Reply hazy try again.Ask again later.Better not tell you now.Cannot predict now.Concentrate and ask again.Don't count on it.My reply is no.My sources say no.Outlook not so good.Very doubtful".split('.')[hash(id)%20])

我以前使用的是hash内置索引(hash(id)%20),从https://bugs.python.org/issue13703开始,Python解释器每次启动都会返回一个随机值。不过,对于空字符串(总是为0)来说,它不是随机的,因此需要使用其他id内置函数!

从第二个角度看,我可以id直接使用它,但是它似乎总是产生偶数。IIRC id(object)在CPython中仅返回的存储位置object,因此这很有意义。也许如果我使用Jython或IronPython,则可以跳过7分频。无论如何,hash(id)vs id(0)//7在Python 3中是相等的,但是可以/在Python 2中使用运算符来截断整数除法,从而节省一个字节。


13

PowerShell,354字节

"It is certain0It is decidedly so0Without a doubt0Yes definitely0You may rely on it0As I see it, yes0Most likely0Outlook good0Yep0Signs point to yes0Reply hazy try again0Ask again later0Better not tell you now0Cannot predict now0Concentrate and ask again0Don't count on it0My reply is no0My sources say no0Outlook not so good0Very doubtful"-split0|Random

在线尝试!

哼 将所有结果与0s 串联在一起,然后将-splits继续0以创建字符串数组。传递给该数组,Get-Random该数组将随机选择其中之一。剩下的就在管道上,输出是隐式的。


11

Python 2,385字节

-1字节感谢ovs。

from random import*
print choice("It is certain.It is decidedly so.Without a doubt.Yes definitely.You may rely on it.As I see it, yes.Most likely.Outlook good.Yep.Signs point to yes.Reply hazy try again.Ask again later.Better not tell you now.Cannot predict now.Concentrate and ask again.Don't count on it.My reply is no.My sources say no.Outlook not so good.Very doubtful".split('.'))

在线尝试!


22
@Downvoter,请问您为什么对每个答案都投票否决?
–totalhuman

7
我认为这是可疑的投票行为,我建议举报该问题以引起国防部长的注意,以便他们进行调查。
粗野的

9

Applescript,391

我喜欢AppleScript列表中的some item方法:

{"It is certain","It is decidedly so","Without a doubt","Yes definitely","You may rely on it","As I see it,yes","Most likely","Outlook good","Yep","Signs point to yes","Reply hazy try again","Ask again later","Better not tell you now","Cannot predict now","Concentrate and ask again","Don't count on it","My reply is no","My sources say no","Outlook not so good","Very doubtful"}'s some item

5
在3、2、1中提示所有问题的平庸心态答案。继续-我敢于告诉你你是谁,并解释你的否决理由。还是您会继续潜伏在阴影中?
Digital Trauma'3

7

Bash + GNU实用程序,230

  • @Dennis节省了15个字节。
sed 1d $0|zcat|shuf -n1
# zopflied 8 ball list

此处的二进制zopfli输出没有很好地表示。相反,您可以从base64编码的数据重建脚本:

base64 -d << EOF > 8ball.sh
c2VkIDFkICQwfHpjYXR8c2h1ZiAtbjEKH4sIAAAAAAACAz1QSZJCMQjd5xRv1fOlMEGlzIdfgbRF
n75NOayYeYMExFF5BImWe9W4SuPWE27lKnG2GSA0m4coyWvhKCrBPUvaxEaJcStgColCDoEzQ+IH
t/WymQe6XNa+zehmF5zMWknei8tJHbuJBsKw9gfvPXGmv0SMBJ0WNfLLPUOn4FEOHMEDaoHg3rGI
qF1LJV29fXCTGveWaWWNQcEgbXi9Ks30PVBtauBOfkvc4cWhtkq3OSo7nBJqLwELxO2u45dH3u05
zv4=
EOF

注意,如问题所允许,压缩数据将解压缩为所有小写字母。这使得zopfli压缩效率更高,并节省了16个字节。


tail +2不适用于我,但还是sed 1d $0节省了一个字节。另外,由于默认情况下允许输出到STDERR,所以我认为您不需要exit。同样,可以删除程序的最后十个字节。
丹尼斯,

@丹尼斯,谢谢!额外输出到STDERR总是让我感到有些不舒服,但是我想我应该使用它。
Digital Trauma'3

6

R,360字节

sample(readLines(),1)
It is certain
It is decidedly so
Without a doubt
Yes definitely
You may rely on it
As I see it, yes
Most likely
Outlook good
Yep
Signs point to yes
Reply hazy try again
Ask again later
Better not tell you now
Cannot predict now
Concentrate and ask again
Don't count on it
My reply is no
My sources say no
Outlook not so good
Very doubtful

在线尝试!

并非最优雅的解决方案。R具有一个整洁的功能,stdin可以重定向到源文件,因此您可以将(小型)数据集放入源代码中,保存字节以进行字符串分割或更糟,构造向量本身(所有这些引号加在一起)。连同用于随机采样的内置函数,这是一个简短的答案。


6

木炭203个 184字节

‽⪪”}∨74Dυ3↖u➙H�↖vI⁻VR‹ψ#�Ii»ψPNξ⮌≔;≡8ν}¬H⁺ºº↖H⁴K⌕êτ|⁼➙⟲W»″φ◨⟦(τ(jK“N\⍘“↷⊙ⅉvT>➙§⌊Fζ³⁻↔;TaÀ✳⁴≔67⍘i4¬⸿-A8⁻f7¡<⁰Zχ}ζ'¡¹→Oaε!OυP₂ïμ´MuP⁺M⮌1№-k¹№FvξDü⊟ζⅉ⁰xW:Dε7TvM₂⊞θC⪪Rε⁰“D¡⸿⁰″A⊕λξ↥~O·PE&”¶

在线尝试!链接是详细版本的代码。编辑:通过小写形式保存了19个字节。说明:

  ”...”     Compressed string of newline-delimited responses
 ⪪     ¶    Split on newlines
‽           Random element
            Implicitly print

5

视网膜333个 331 321字节


0cert10decided2so¶with34a d3bt¶yes definitely¶y3 ma5re26as i see it, yes¶mos4likely7good¶yep¶signs poin4to yes¶rep2haz5tr5ag18ain later¶better 94tell y3 9w¶can94predic49w¶concentrate and 81don'4c3n46m5rep2is 9¶m5s3rces sa59794so good¶ver5d3btful
9
no
8
ask ag
7
¶3tlook 
6
on it¶
5
y 
4
t 
3
ou
2
ly 
1
ain¶
0
it is 
G?`

在线尝试!编辑:通过压缩保存1个字节,doubt并通过小写所有内容保存1个字节,这样我就可以压缩reply。然后使用@Leo的Retina Kolmogorov高尔夫球手在小写字母文本上保存10个字节(巧合的是,它在我的333字节答案中保存了字节数)。



@Leo请注意,Retina 0.8.2是另一种语言
mbomb007 '18

@ mbomb007我知道,但是对于像这样的简单替换,它具有与Retina 1.0相同的语法。我只是指出Kolmogorov高尔夫球手是为较旧版本的Retina编写的,但在这种情况下仍然可以使用。
狮子座

4

椰子,380字节

全人类的椰子港的答案

from random import*
choice$("It is certain.It is decidedly so.Without a doubt.Yes definitely.You may rely on it.As I see it, yes.Most likely.Outlook good.Yep.Signs point to yes.Reply hazy try again.Ask again later.Better not tell you now.Cannot predict now.Concentrate and ask again.Don't count on it.My reply is no.My sources say no.Outlook not so good.Very doubtful".split('.'))

在线尝试!


4

T-SQL,393个字节

SELECT TOP 1*FROM STRING_SPLIT('It is certain-It is decidedly so-Without a doubt-Yes definitely-You may rely on it-As I see it, yes-Most likely-Outlook good-Yep-Signs point to yes-Reply hazy try again-Ask again later-Better not tell you now-Cannot predict now-Concentrate and ask again-Don''t count on it-My reply is no-My sources say no-Outlook not so good-Very doubtful','-')ORDER BY NEWID()

该功能STRING_SPLIT仅在SQL 2016及更高版本中可用。

对于以前的版本,我能获得的最好VALUES('It is certain'),('It is decidedly so'),...结果是464个字符。

格式化后,就可以看到工作部分:

SELECT TOP 1 *
FROM STRING_SPLIT('It is certain-It is decidedly so-...', '-')
ORDER BY NEWID()

NEWID() 生成新的伪随机GUID,这是一种进行伪随机排序的方法。


4

果冻,201字节

-2个字节,感谢Xcoder先生。-1个字节,感谢user202729。

“æ⁽IẊ?⁽ʋṠ¶ÐƝKW¬ḃỴɓ⁾:Eṇ⁵ṾɱD×⁴2ṇỤðċỊ¥ḷƬị÷ṣÐṆⱮ$u²OŀṚƁȮ1⁼ṁ$bp⁾v]Ɠ-/NẓḲnỵdḳḋ½ȥṿ=kv¥ɓl[kR AḞ¶gḣḞiẊŒẊḳçȤ⁻Ɱʋx:ØṖ|zY=ṾḌẓY1Ḃ$50d⁹⁸ŀhʂƤṢM;ḢoƁṾ⁷-uṙu¡Ọ3ṣȮ@⁹ðẹȥXƭ⁸|ƬẋẆḢɠœxḳsĿƘ(0çỌ~A½YIEFU3Ọ=⁷ɗḷBḷİṄhṗgṡƊẏẏḄ#Ṙʋ$ʂȷĠ»ỴX

在线尝试!

该死的,SOGL的压缩效果很好。



201字节。只需追加最后两个字符。
user202729

(我的意思是,将ỴX代码附加到代码的末尾,以便它从其中之一中随机选择)
user202729

4

05AB1E,171个字节

“€•€ˆ‹ì€•€ˆŸíly€Ê„›€…¬³…ܴ΀˜€‰€•€œ I€È€•,…Ü‚¢îÙ®½‚¿ yepŸé…®€„…Ü…ƒ hazy‡Ü†îˆ¹†îŠ´…瀖ˆœ€î€Ó€©notßä€Óä考ˆ¹†î€·n'tš‹€‰€•€¯…ƒ€ˆ€¸€¯Žç…耸®½€–€Ê‚¿‚Ò¬³ful“#•8∞f{ʒβ®•6в£ðýΩ

在线尝试!

说明

“ ... “推送所有必需单词的字符串。
有些单词直接来自05ab1e词典。
有些以纯ascii格式写出(如haze)。
有些是结合了字典和ascii(例如do+n't)。

那么处理代码为:

#                 # split string on spaces to a list of words
 •8∞f{ʒβ®•        # push the number 2293515117138698
          6в      # convert to a list of base-6 numbers 
                  # ([3,4,3,2,5,5,2,2,1,4,4,3,5,3,4,4,4,4,4,2])
            £     # group the list into sublists of these sizes
             ðý   # join on spaces
               Ω  # pick one at random

在线尝试!-176次暴力破解。
魔术章鱼缸

1
@MagicOctopusUrn:我认为是182,,并且'添加了。
Emigna

天哪!我知道了,是的。顺便说一下,从您的TIO中删除输入,这有点令人困惑。
魔术八达通

@MagicOctopusUrn:哦!谢谢。我不知道我该
留在那儿了

166:TIO。使用新的词典单词(yedonha)时是-1,而使用单词计数对列表进行排序并使用增量压缩则是-2。
Grimmy

4

Ruby,362361字节

puts"It is certain.It is decidedly so.Without a doubt.Yes definitely.You may rely on it.As I see it, yes.Most likely.Outlook good.Yep.Signs point to yes.Reply hazy try again.Ask again later.Better not tell you now.Cannot predict now.Concentrate and ask again.Don't count on it.My reply is no.My sources say no.Outlook not so good.Very doubtful".split(?.).sample

在线尝试!

  • 1字节感谢@ benj2240

您可以使用?.代替剃掉一个字节'.'
benj2240 '18

@ benj2240哇,我以前没看过。很酷。
BigRon

1
我不得不去研究有关?单个字符串文字
BigRon

3

Python 3,386个字节

from random import*
lambda:choice("It is certain;It is decidedly so;Without a doubt;Yes definitely;You may rely on it;As I see it, yes;Most likely;Outlook good;Yep;Signs point to yes;Reply hazy try again;Ask again later;Better not tell you now;Cannot predict now;Concentrate and ask again;Don't count on it;My reply is no;My sources say no;Outlook not so good;Very doubtful".split(';'))

3

佩尔366

print((split",","It is certain,It is decidedly so,Without a doubt,Yes definitely,You may rely on it,As I see it,yes,Most likely,Outlook good,Yep,Signs point to yes,Reply hazy try again,Ask again later,Better not tell you now,Cannot predict now,Concentrate and ask again,Don't count on it,My reply is no,My sources say no,Outlook not so good,Very doubtful")[rand 19])

2
我发现了一个错误。您不能使用逗号作为分隔符,因为Magic 8球的可能答案之一包含逗号:As I see it, yes
g4v3

1
我建议您使用一位数字作为分隔符。由于不再需要使用引号,因此它将节省1个字节,但仍必须添加空格来分隔数字和split
g4v3

1
另外,您可以省略括号,print并再保留1个字节。只需在列表前加上一元加号即可:print((0..9)[5])会变成print+(0..9)[5]
g4v3

3

05AB1E208个 217字节

"don'".•W˜FζÃT¥„ò.1₁∍Y<`Ì°5jýúž+ìmHSéÁ¬–xȃø‚ž}_Øviòª§l["]0â^)„2æδ∍G1∊EÌLÝ'îôΛβ;ƒĀαÏw L°gðÈγ³€wE‘f饤šαrˆQŠë¢-º8Æ~ÁŠ∍δBx®(β™Žü6»ƶÙÐ~†«\%ÍŒΘ-´sÈƵJŸ₃H7Ó˜:Å∍₂èÑï∞—Râú'óвb…ÓUXʒǝ₄ÝrÒ₄¨÷ä褓oθWÎλî~bj(Ri
Þиe‘ãj]•", yes"J'x¡Ω

在线尝试!

相当基本的解决方案。可能的答案与字符x串联(因为答案中不存在该字符),然后将其压缩(在•内), 'x¡Ω在x上分割并弹出一个随机选择。

感谢@Emigna指出字母压缩不太喜欢'或,。通过使用don'yes替换压缩字符串来解决。


拆分不存在的字符的好主意。不幸的是字母压缩内容替换,,并'用空格,所以输出对于那些2线接错。
Emigna

@Emigna非常感谢您指出!我想知道是否没有针对此问题的更好的解决方案...我可以在答案中使用其他未使用的字符,但是只有两个:q和x :-(
Kaldo

3

PHP412个 385 337 384字节

<?php $a=explode(1,"It is certain1It is decidedly so1Without a doubt1Yes definitely1You may rely on it1As I see it, yes1Most likely1Outlook good1Yep1Signs point to yes1Reply hazy try again1Ask again later1Better not tell you now1Cannot predict now1Concentrate and ask again1Don't count on it1My reply is no1My sources say no1Outlook not so good1Very doubtful");echo$a[array_rand($a)];

在线尝试!

相当简单的解决方案。用定界符分割字符串(在本例中为1),然后从数组中选择一个随机元素。


欢迎来到PPCG!我对您的帖子进行了一些小的格式更改,并提出了一些小建议-1,您需要在其后添加一个空格php以使代码得以编译;2,您可以替换'|'1和所有|1为-2字节; 3应该考虑将社区的在线尝试链接更改为TIO.run。
泰勒·斯科特

这是基于我的反馈意见的有效版本。在线尝试!
泰勒·斯科特

@TaylorScott在我的环境中,似乎在<?php标记后没有空格的情况下工作正常。我在跑步PHP 7.2.3-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Mar 6 2018 11:18:25) ( NTS )。不知道在以前的版本中是否重要。无论哪种方式,我都已编辑了问题。
安德鲁(Andrew)

嗯,可能只是版本-您提供的链接使用的是PHP版本7.0.3,并且没有空格就无法在TIO.run上运行
Taylor Scott

2
您可以使用<?=[rand(0, 19)]不是直接添加到变量来直接回显爆炸<?= explode("1", "str1str1str")[rand(0, 19)]
Jeroen

3

Javascript,372个字节

-10个字节,感谢Shaggy

_=>"It is certain.It is decidedly so.Without a doubt.Yes definitely.You may rely on it.As I see it, yes.Most likely.Outlook good.Yep.Signs point to yes.Reply hazy try again.Ask again later.Better not tell you now.Cannot predict now.Concentrate and ask again.Don't count on it.My reply is no.My sources say no.Outlook not so good.Very doubtful".split`.`[Math.random()*20|0]

在线尝试!


1
使用按位OR而不是Math.floor()节省7个字节:Math.random()*20|0
毛茸茸的

3

Befunge

1221 870字节(整个字段的周长为33x36 30 * 29个字符)感谢Jo King帮助我删除了结尾的null并敦促我更改随机数。

"<"99+9+1+v
v         <
 >>>>>>>>>>55++v
 0123456789
>??????????<
 0123456789
 >>>>>>>>>>    v
               >88++p       v
v"It is certain"           
v"It is decidedly so"
v"Without a doubt"
v"Yes definitely"
v"You may rely on it"
v"As I see it, yes"
v"Most likely"
v"Outlook good"
v"Yep"
v"Signs point to yes"
v"Reply hazy try again"
v"Ask again later"
v"Better not tell you now"
v"Cannot predict now"
v"Concentrate and ask again"
v"Don't count on it"
v"My reply is no"
v"My sources say no"
v"Outlook not so good"
v"Very doubtful"
>:#,_@

第一行将'<'字符和x位置(28)放在堆栈上的位置。然后我们输入随机数生成器的种类。可以对此进行改进,但这是我可以在短时间内提供的内容……将“随机”数字偏移以获取实际的“随机”行以进行读取。

生成随机数后,我们将'<'字符放在该行,并将字母压入堆栈,并在最底一行再次输出它们。

注意; 如果您使用我在此帖子标题中链接的解释器,则每次运行后都必须重新单击“显示”,因为执行后仍会添加'<'字符。


1
您最好使用与我的> <>答案相同的格式。在线尝试!。现在,它还在末尾打印一堆空字节
Jo King

是的,我知道,我希望不要对随机数产生太大的偏见,但是我可以只使用一行问号。
rael_kid

您至少可以消除数百个字节的空白,然后更改最后一行>:#,_@以避免打印空字节。哦,并添加一个TIO链接。
乔·金

是的,我将在今天晚些时候发布更新。
rael_kid

3

Java的8433392380,379个字节

 a->"It is certain~It is decidedly so~Without a doubt~Yes definitely~You may rely on it~As I see it, yes~Most likely~Outlook good~Yep~Signs point to yes~Reply hazy try again~Ask again later~Better not tell you now~Cannot predict now~Concentrate and ask again~Don't count on it~My reply is no~My sources say no~Outlook not so good~Very doubtful".split("~")[(int)(Math.random()*20)]

在线尝试!

  • 感谢AdmBorkBork的41个字节!
  • 感谢凯文10个字节!
  • 1字节感谢Oliver!

2
当然,您可以使用String.split()保存一堆字节—docs.oracle.com/javase/7/docs/api/java/lang/…–
AdmBorkBork,

2
@AdmBorkBork所述,您可以使用保存41个字节String#split。另外,您可以使用(int)(Math.random()*20)代替来节省额外的11个字节new java.util.Random().nextInt(20)。分号不计入lambda的字节数。因此总计:380个字节
凯文·克鲁伊森

2
您的答案和@KevinCruijssen的高尔夫球场中都有多余的空间:使用Don't代替Don' t
奥利维尔·格雷戈尔

2

红色,367字节

prin pick split{It is certain.It is decidedly so.Without a doubt.Yes definitely.You may rely on it.As I see it, yes.Most likely.Outlook good.Yep.Signs point to yes.Reply hazy try again.Ask again later.Better not tell you now.Cannot predict now.Concentrate and ask again.Don't count on it.My reply is no.My sources say no.Outlook not so good.Very doubtful}"."random 20

在线尝试!

它在TIO中似乎并不是真正随机的(尽管在Red Console中工作得很好),这就是为什么我在标头中添加了随机/种子的原因。


2

Excel,399字节

=CHOOSE(1+20*RAND(),"It is certain","It is decidedly so","Without a doubt","Yes definitely","You may rely on it","As I see it, yes","Most likely","Outlook good","Yep","Signs point to yes","Reply hazy try again","Ask again later","Better not tell you now","Cannot predict now","Concentrate and ask again","Don't count on it","My reply is no","My sources say no","Outlook not so good","Very doubtful")

以来 CHOOSE(X.Y,<>)与相同CHOOSE(X,<>),因此不需要INT

不过,您在这里可以打的高尔夫球并不多...


2

Aceto,345 + 1 = 346字节(-l标志为+1 )

"It is certain.It is decidedly so.Without a doubt.Yes definitely.You may rely on it.As I see it, yes.Most likely.Outlook good.Yep.Signs point to yes.Reply hazy try again.Ask again later.Better not tell you now.Cannot predict now.Concentrate and ask again.Don't count on it.My reply is no.My sources say no.Outlook not so good.Very doubtful"'.:Yp

在线尝试!

不太有趣,但是我想不出这种语言中的任何简短内容,压缩字符串等等。

“ ....”按句号分隔的字符串
      '。文字时期
        :按期分割
         Y  shuffle stack
          p  print top


without the -l flag might look more interesting.
Laura Bostan

@LauraBostan But I don't know hilbert curves past type 3
drham

and it's more bytes for all of the \n
drham

1
But yes it would look more 'interesting' per se
drham

iup... the -l flag was added for golfing. However, I am not very fond of it, steals cheaply the whole point of the language. Maybe next version of Aceto will give up this flag.
Laura Bostan

1

C - 426 bytes

char a[][99]={"It is certain","It is decidedly so","Without a doubt","Yes definitely","You may rely on it","As I see it, yes","Most likely","Outlook good","Yep","Signs point to yes","Reply hazy try again","Ask again later","Better not tell you now","Cannot predict now","Concentrate and ask again","Don't count on it","My reply is no","My sources say no","Outlook not so good","Very doubtful"};int main(){int n;puts(a[n%20]);}

Uses an uninitialized variable mod 20 to index into an array of strings containing all possible outputs. Compilers complain that stdio.h isn't included, but it works OK. Probably because it just so happens to have the standard library linked in anyways. Lucky me.


Worth noting on some implementations, an uninitialized variable has a value of 0, since the behavior is, well, undefined. Ask your magic 8-ball whether this is true on your machine.
Orion

1

Go, 530 Bytes

package main;import"fmt";func main(){for k:=range map[string]struct{}{"It is certain":{},"It is decidedly so":{},"Without a doubt":{},"Yes definitely":{},"You may rely on it":{},"As I see it, yes":{},"Most likely":{},"Outlook good":{},"Yep":{},"Signs point to yes":{},"Reply hazy try again":{},"Ask again later":{},"Better not tell you now":{},"Cannot predict now":{},"Concentrate and ask again":{},"Don't count on it":{},"My reply is no":{},"My sources say no":{},"Outlook not so good":{},"Very doubtful":{}}{fmt.Print(k);break}}

Please note that, on the Go Playground, because of how seeding works, it always gives the same result. When running on a regular computer, everything works as it should.
I think it is possible to save a bit more but my knowledge in Go stops there :)

Formatted and testable version


Welcome to PPCG! The Go interpreter on Try It Online seems to use a random seed.
Dennis

I must be terribly unlucky then D:
Nathanael C.

Are you refreshing the page? That would fetch the result from cache every time, so it won't change. Clicking the Run button will run the code again.
Dennis

I keep getting "It is certain" even after with a CTRL+R to hard refresh... I don't get it :x
Nathanael C.

Refreshing won't change the result; they are cached on the server side. Click the run button (play icon in a circle) or press Ctrl-Enter.
Dennis

1

Excel-VBA, 362 341 339 Bytes

v=[1:1]:?v(1,Rnd*19)

Where A1:T1 contain the different options. Reads entire first row of sheet into array v and indexes a random point along the first 19 values.

Surprised to find that indexing an array doesn't require integer values


My concerns about your answer for Excel are even more so here, as the Worksheet is counted as a STDIN for Excel VBA, so this is closer to having pre-determined input
Taylor Scott

0

VBA, 358 bytes

An anonymous VBE immediate window function that takes no input and outputs to STDOUT.

?Split("It is certain1It is decidedly so1Without a doubt1Yes definitely1You may rely on it1As I see it, yes1Most likely1Outlook good1Yep1Signs point to yes1Reply hazy try again1Ask again later1Better not tell you now1Cannot predict now1Concentrate and ask again1Don't count on it1My reply is no1My sources say no1Outlook not so good1Very doubtful",1)(19*Rnd)

-1

Java 8, 379 Bytes

b->"It is certain-It is decidedly so-Without a doubt-Yes definitely-You may rely on it-As I see it, yes-Most likely-Outlook good-Yep-Signs point to yes-Reply hazy try again-Ask again later-Better not tell you now-Cannot predict now-Concentrate and ask again-Don't count on it-My reply is no-My sources say no-Outlook not so good-Very doubtful".split("-")[(int)(Math.random()*20)]

Try it online

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.