재미있는 코드 골프 - 이번에는 맥주99병을 해보아요~ ^^

2476
points
points
http://codegolf.com/99-bottles-of-beer
Perl의 경우 170바이트가 1위인데,
저는 174바이트에서 막혔습니다.
뭐 당연히... 이것도 제 힘만으로 한 건 아니고 OTL
저 혼자 하는 걸로는 220바이트 정도에서 막히더군요. 이리저리 끙끙대 보다가, 이것만 붙잡고 하염없이 있을 수가 없다보니 컨닝 비스무리하게... http://99-bottles-of-beer.net/language-perl-727.html 여기 코멘트란에 있는 코드를 가지고 코드골프 사이트에서 요구하는 출력에 맞게 고쳤습니다.
4바이트를 도저히 못 줄이겠네요. 아니면 170바이트가 되려면 이 형태로는 안 되고 아예 새로 뜯어고쳐야 할지도?
sub b{[@b=(abs||99,bottle."s"x!!++$_,of,beer),on,the,wall]}print"@{+b}, @b.
",$_?"Take one down and pass it around":"Go to the store and buy some more",", @{+b}.
"for-99..-1(위 코드의 줄바꿈은 일부러 추가한게 아니라, 스트링 안에서 "\n"이 들어가는 자리를 그냥 편집기에서 엔터를 눌러 입력한 겁니다)
»
- 인쇄에 적합한 버전
- Login or register to post comments
- 3000번 읽힘

points
이것도 한번
이것도 한번 도전해보려 했지만 너무 어려워보여서 못하고있었네요
ascii art(도저히 1바이트가 안줄어듬.. OTL)는 잠시 보류하고 이걸 해봐야겠습니다.. ㅋㅋ
points
ASCII art 때와 달리
ASCII art 때와 달리 이번 종목은 호응이 별로 없군요 ^^;
그나저나 1바이트가 남은 상태라면, vi로 편집하는 경우 제일 끝에 자동으로 "\n"을 붙여버리니까 그것 때문에 1바이트 손해보고 있는 건 아닌지 확인해보세요. ":set noeol binary"해 준 후 저장하면 (jg님이 가르쳐주신 거) 붙이지 않게 할 수 있습니다.
points
sub
sub b{[@b=(-$_,bottle."s"x!!++$_,of,beer),on,the,wall]}print"@{+b}, @b.",$_?"Take one down and pass it around":"Go to the store and buy some more",", @{+b}.
"for-99..-1
이거면? 169인데요.. 뭔가 잘못했나.
points
http://codegolf.com/competiti
http://codegolf.com/competition/output/99-bottles-of-beer
제일 마지막 라인 보시면 다시 99병이 되어야 합니다. :-)
points
첫 시도인 204B짜리
첫 시도인 204B짜리 루비코드 입니다.
def c(n)"#{n} bottle#{n>1?'s':''} of beer"end
99.downto(1){|n|puts"#{c(n)+w=' on the wall'}, #{c(n)}.
#{n>1?'Take one down and pass it around':'Go to the store and buy some more'}, #{c(n>1?n-1:99)+w}.
"}
-ㅅ-a
points
아.. 어렵네요.
아.. 어렵네요. 엉뚱한 174B버전만 하나 더 만들었습니다. =_=
sub b{[@b=(-$_++||99,bottl.($_?es:e),of,beer),on,the,wall]}print"@{&b}, @b.
",$_?"Take one down and pass it around":"Go to the store and buy some more",", @{&b}.
"for-99..-1
일단 gg..
--
perl -e's@@JEON Myoung-jin@;sub man{s| _|her e|}
sub see{s;^;Just;;u;s;e ;Perl ;;to;print$_,$/}$uperMan=M;
s=^....=U are not=;s~$uperMan~~;&admitIt;s=U are = A=;s|young|_|;&man;
sub admitIt{say;ye;s!-\w+! Hacker!};see U'