2010年,冰岛火山爆发(简称埃亚菲亚拉赫尔 ),导致我计划已久的航班被取消。
如果这种情况再次发生,我真的很想事先知道,所以请帮助我建立一个简单的视觉警报系统!
以冰岛气象局火山活动警报代码作为输入(字符串):
绿火山处于正常的非喷发状态。
黄色火山正经历着比已知背景水平更高的动荡迹象。
橙色-火山正表现出更大的动荡,爆发的可能性增加。
据预测,红色喷发即将来临,火山灰可能会大量排放到大气中。
该图形(ASCII艺术)警报,说明了Eyjafjallaj kull的状态。
绿色(Eyjafjallaj kull正在休息)
al la
j j
jaf öku
y l
E l
-------------------黄色(冒出一些烟雾!)
~ ~
~
al la
j j
jaf öku
y l
E l
-------------------橙色(更多的烟!)
~ ~ ~
~ ~
~
al la
j j
jaf öku
y l
E l
-------------------红色(更多的烟雾和一些灰烬,也!)
`~ ~ ~ ~ ~ ~`
` ~ ~ ~ `
` ~ ~ `
` ~ `
al la
j j
jaf öku
y l
E l
-------------------发布于 2016-11-30 23:55:17
这是我对冰岛著名的地标建筑Eyjafjallaj kull Tower的看法。
相当短,但我还没有想出一个很好的方法来打高尔夫球。
->n{m=85-n[-3].ord>>2
%w{`~+~+~+~+~+~` `+~++~++~+` `+~+++~+` `+~+` al%3sla j%7sj jaf%9soku y%15sl E%17sl}.map{|i|(i%"").tr(?++?`*m," ").center(19)}[m,9]+[?-*19]}中未使用
f=->n{m=85-n[-3].ord>>2 #From ASCII code of 3rd from last letter, derive m=0 for RED up to 4 for GREEN (uppercase.)
%w{`~+~+~+~+~+~` `+~++~++~+` `+~+++~+` `+~+` al%3sla j%7sj jaf%9soku y%15sl E%17sl}.
map{|i| #For each line above decode as follows:
(i%""). #Replace %Xs with X spaces, by inserting empty strings and padding sprintf style.
tr(?++?`*m," "). #Replace + with space. If not red, replace ` with space.
center(19)}[m,9]+ #Centre output to 19 characters per line. Start printing at line m and go on to the end (never more than 9 lines.)
[?-*19] #Add a row of --- at the bottom.
}
puts f[gets.chomp]发布于 2016-11-30 21:12:42
@set e=echo
@%e%off
set s=
set t=
goto %1
:RED
set t= `
%e% `~ ~ ~ ~ ~ ~`
:ORANGE
%e% %t%~ ~ ~%t%
:YELLOW
%e% %t%~ ~%t%
%e%%s%%t%~%t%
:GREEN
%e%%s%al la
%e% j%s% j
%e% jaf %s% oku
%e% y %s%%s% l
%e%E%s%%s%%s%l
%e%--------------------注意:第1行和第7行有一个尾随空间,第3行有6个,第4行有3个。
发布于 2016-12-01 11:25:19
s=' '
y=' ~ '
v='ROY G'.index(input()[0])
a='` '[v>0]
print'\n'.join([s*3+a+'~'+' ~'*5+a,s*4+a+y*3+a,s*5+a+y*2+a,s*7+a+y+a,s*6+'al la ',s*5+'j j\n jaf'+s*9+'öku\n y'+s*15+'l\nE'+s*17+'l','-'*19][v:])https://codegolf.stackexchange.com/questions/101637
复制相似问题