Omnimaga

Calculator Community => Contests => Community Contests => Topic started by: JWinslow23 on September 15, 2014, 06:50:58 pm

Title: [ENDED] Code Golf Contest #10
Post by: JWinslow23 on September 15, 2014, 06:50:58 pm
Ten is three, three is four, four is MAGIC. O.O

NEXT: Here (http://www.omnimaga.org/other-calculator-discussion-and-news/code-golf-contest-11)
PREVIOUS: Here (http://www.omnimaga.org/other-calculator-discussion-and-news/code-golf-contest-9)

Challenge 10

Problem
Create a program which displays the Olympic Rings, following these criteria:
Deadline
September 22, 2014, 1:00 AM EST

If any further clarifica...you know what? Nobody ever reads this part! Whatever, I don't have a pun anyways. Not that anybody reads that, either. :(

Ruby
RankUserSizeDateCode
1Juju220-70%=669/16/2014 8:35:42 AM
Spoiler For Spoiler:
puts"\x1b[2J"
def H(x,y);"\x1b["+x.to_s+";"+y.to_s+"H";end
def a(x,y,c);2.times{|i|puts"\x1b[3"+c.to_s+"m"+H(x+i+1,y)+"#"+H(x+i+1,y+5)+"#"+H(x+3*i,y+1)+"####"+"\x1b[0m"};end
a(1,1,4);a(1,7,0);a(1,13,1);a(3,4,3);a(3,10,2)

Golfscript
RankUserSizeDateCode
1JWinslow2347-40%=28.29/15/2014 11:16:11 PM
Spoiler For Spoiler:
' bb  ll  rr
b '' by  lg  rr'
.);n@'
   yy  gg'

CJam
RankUserSizeDateCode
1JWinslow2347-40%=28.29/15/2014 11:16:11 PM
Spoiler For Spoiler:
" bb  ll  rr
b "" by  lg  rr"
_);N@"
   yy  gg"
2pimathbrainiac54-40%=32.49/15/2014 7:11:40 PM
Spoiler For Spoiler:
" bb  ll  rr"N"b  by  lg  r"N" by  lg  rr"N"   yy  gg"

C
RankUserSizeDateCode
1pimathbrainiac101-40%=60.69/15/2014 7:11:40 PM
Spoiler For Spoiler:
#include <stdio.h>
int main(){printf(" bb  ll  rr\nb  by  lg  r\n by  lg  rr\n   yy  gg");return 0;}

Nspire Lua
RankUserSizeDateCode
1Jens_K94-70%=28.29/16/2014 7:18:56 AM
Spoiler For Spoiler:
function on.paint(g)
for i=0,4 do
g:setColorRGB(9E5*i)g:drawArc(9+i*5,9+i%2*5,9,9,205-i%2*90,i>0 and 330 or 360)end
end
2LDStudios80-50%=409/18/2014 5:26:33 AM
Spoiler For Spoiler:
for i=1,5 do a=(i>3 and 5 or 0)gc:setColorRGB(i*42)gc:drawString(0,i*8-a*4,a)end
3Adriweb84-50%=429/15/2014 11:38:14 PM
Spoiler For Spoiler:
function on.paint(g)for i=4,16,3 do g:setColorRGB(i^5)g:drawString(0,i,i%2*4)end end

Language Ranking
RankLangUserSizeDate
1CJamJWinslow2328.29/15/2014 11:16:11 PM
2GolfscriptJWinslow2328.29/15/2014 11:16:11 PM
3Nspire LuaJens_K28.29/16/2014 7:18:56 AM
4Cpimathbrainiac60.69/15/2014 7:11:40 PM
5RubyJuju669/16/2014 8:35:42 AM
Title: Re: Code Golf Contest #10
Post by: LDStudios on September 15, 2014, 07:38:54 pm
Quick question, is it okay on a color calc, if i make the rings gray scale to save bytes? It doesn't seem fair for me to have to do full color when anyone on a grayscale calc doesn't have to.

496 bytes (but so pretty!):
(http://img.ourl.ca/09-15-2014%20Image001.png)

161 bytes:
(http://img.ourl.ca/09-16-2014%20Image004.png)
Title: Re: Code Golf Contest #10
Post by: JWinslow23 on September 15, 2014, 07:48:49 pm
As long as the "colors" are all distinct, this is allowed.
Title: Re: Code Golf Contest #10
Post by: pimathbrainiac on September 15, 2014, 08:10:20 pm
54 bytes of CJam and 101 bytes of GNU C

TAKE THAT!!!
Title: Re: Code Golf Contest #10
Post by: Juju on September 15, 2014, 09:14:02 pm
  • The program must not access an external source, Juju :P
I didn't do that? o.o
Title: Re: Code Golf Contest #10
Post by: Adriweb on September 15, 2014, 10:18:59 pm
Also please don't take solutions from here : http://codegolf.stackexchange.com/questions/18986/draw-the-olympic-games-logo
Title: Re: Code Golf Contest #10
Post by: JWinslow23 on September 15, 2014, 10:37:23 pm
  • The program must not access an external source, Juju :P
I didn't do that? o.o
Code Golf 9, Bash. :P perl isn't on every PC.

Also please don't take solutions from here : http://codegolf.stackexchange.com/questions/18986/draw-the-olympic-games-logo
Yes, golf them. :P
Title: Re: Code Golf Contest #10
Post by: Juju on September 15, 2014, 11:16:42 pm
  • The program must not access an external source, Juju :P
I didn't do that? o.o
Code Golf 9, Bash. :P perl isn't on every PC.
Oh, right. Thought it was. Well, on systems where Bash is installed, Perl should typically be installed as well, but I can easily be wrong.
Title: Re: Code Golf Contest #10
Post by: Adriweb on September 15, 2014, 11:21:46 pm
Nspire-Lua :

66 bytes for this (black and white) :
(http://i.imgur.com/kk1ctvk.png)

82 with varying shades of blue (we can't really see but yes, it's different) :
(http://i.imgur.com/1K1fat6.png)

83 for a little bit visually distinct :
(http://i.imgur.com/HuIqaeD.png)

84 for visually ""very"" distinct colours :
(https://i.imgur.com/JOdhUMq.png)

What's submittable among that ?
Title: Re: Code Golf Contest #10
Post by: JWinslow23 on September 15, 2014, 11:54:39 pm
Nspire-Lua :

66 bytes for this (black and white) :
(http://i.imgur.com/kk1ctvk.png)

82 with varying shades of blue (we can't really see but yes, it's different) :
(http://i.imgur.com/1K1fat6.png)

83 for a little bit visually distinct :
(http://i.imgur.com/HuIqaeD.png)

84 for visually ""very"" distinct colours :
(https://i.imgur.com/JOdhUMq.png)

What's submittable among that ?
The 84-byte one. If at all possible for graphical entries, colors must be present and distinct.

Also, for ASCII art entries, I am allowing (for example) an output of
  bbbb  ####  rrrr
 b    b#    #r    r
 b   ybyy  g#gg   r
  bbyb  ##g#  rrrr
    y    yg    g
     yyyy  gggg

counting towards only proper interlocking (unless the text is colored in the correct way, in which case it counts for both).

(BTW, what do you think the point reduction values should be for color and/or proper interlocking? I'm thinking along the lines of -40 or -50.)

EDIT:
54 bytes of CJam and 101 bytes of GNU C

TAKE THAT!!!
47 bytes of both CJam and Golfscript.

TAKE THAT!!! :P
Title: Re: Code Golf Contest #10
Post by: JWinslow23 on September 16, 2014, 01:17:07 am
Bump.

I have now implemented the bonuses. You get 40% of your score deducted if the rings are interlocked properly, 50% off if the colors are present and distinct (for ASCII art entries, text must actually be colored), and 70% off (correct me if I'm wrong) for both. Juju, please show me a picture of your Ruby code output; I have no idea if the first criterion is met by yours.
Title: Re: Code Golf Contest #10
Post by: Juju on September 16, 2014, 09:09:21 am
I'll send you the color version soon.

(http://img.ourl.ca/codegolf10.png)
Title: Re: Code Golf Contest #10
Post by: JWinslow23 on September 16, 2014, 09:16:47 am
I'll send you the color version soon.

(http://img.ourl.ca/codegolf10.png)
I have the color version, don't I? ???

But thanks.
Title: Re: Code Golf Contest #10
Post by: Juju on September 16, 2014, 09:43:55 am
Nope, now you do. :P

Also I have a correctly interlocking version in a text file with ANSI color codes, I dunno if that counts as a valid programming language.
(http://img.ourl.ca/codegolf10-2.png)

Also note that the filesize output of ls I give is always one more than necessary because Unices always add a final \n which you can remove.
Title: Re: Code Golf Contest #10
Post by: DJ Omnimaga on September 16, 2014, 01:11:15 pm
For ASCII art, does this also include just using 1 lowercase circle for an entire ring or is that against the rules? :P
Title: Re: Code Golf Contest #10
Post by: Adriweb on September 16, 2014, 02:36:23 pm
Ha, I didn't notice I had 42 points.
I guess I have to stick with this awesome number, now :D
Title: Re: Code Golf Contest #10
Post by: JWinslow23 on September 16, 2014, 08:32:18 pm
For ASCII art, does this also include just using 1 lowercase circle for an entire ring or is that against the rules? :P
The rings must overlap. You can't do that with Os.
Title: Re: Code Golf Contest #10
Post by: Adriweb on September 16, 2014, 09:42:28 pm
I'm replying to JW23 (his PM) publicly so maybe it can help others :

Oh, and do the rings interlock properly?
For me, the rings are drawn from left to right. I don't know how much of an interlocking that counts. Probably none :P But they overlap etc.

Talking about that :
(https://i.imgur.com/JOdhUMq.png)
Title: Re: Code Golf Contest #10
Post by: Princetonlion.tibd on September 16, 2014, 10:06:17 pm
Bump.

I have now implemented the bonuses. You get 40% of your score deducted if the rings are interlocked properly, 50% off if the colors are present and distinct (for ASCII art entries, text must actually be colored), and 70% off (correct me if I'm wrong) for both. Juju, please show me a picture of your Ruby code output; I have no idea if the first criterion is met by yours.
...90%?
Title: Re: Code Golf Contest #10
Post by: DJ Omnimaga on September 16, 2014, 11:29:11 pm
For ASCII art, does this also include just using 1 lowercase circle for an entire ring or is that against the rules? :P
The rings must overlap. You can't do that with Os.
It depends of the calc :trollface:
Title: Re: Code Golf Contest #10
Post by: Juju on September 16, 2014, 11:30:48 pm
That's true, you can actually make letters overlap on the calc. But I guess it's no longer ASCII art in that case.
Title: Re: Code Golf Contest #10
Post by: JWinslow23 on September 16, 2014, 11:32:22 pm
I'm replying to JW23 (his PM) publicly so maybe it can help others :

Oh, and do the rings interlock properly?
For me, the rings are drawn from left to right. I don't know how much of an interlocking that counts. Probably none :P But they overlap etc.

Talking about that :
(https://i.imgur.com/JOdhUMq.png)
Oops, meant to message Jens_K, sorry.
And prince, 50 percent off of 40 percent off of X is 70 percent off, if I'm not mistaken.
Title: Re: Code Golf Contest #10
Post by: DJ Omnimaga on September 16, 2014, 11:44:14 pm
That's true, you can actually make letters overlap on the calc. But I guess it's no longer ASCII art in that case.
Yeah true. Actually even on the 83+ it's possible but it's not as noticeable. But some calcs let you display text of any size like the HP Prime :P
Title: Re: Code Golf Contest #10
Post by: Princetonlion.tibd on September 17, 2014, 12:11:35 am
I'm replying to JW23 (his PM) publicly so maybe it can help others :

Oh, and do the rings interlock properly?
For me, the rings are drawn from left to right. I don't know how much of an interlocking that counts. Probably none :P But they overlap etc.

Talking about that :
(https://i.imgur.com/JOdhUMq.png)
Oops, meant to message Jens_K, sorry.
And prince, 50 percent off of 40 percent off of X is 70 percent off, if I'm not mistaken.
Oh, I just added them together :P
Title: Re: Code Golf Contest #10
Post by: JWinslow23 on September 17, 2014, 06:21:44 pm
Jens_K has tied with Golfscript and CJam! He is now among the ranks of the ASCII artists without being one himself. Nice job, Jens_K. :)
Title: Re: Code Golf Contest #10
Post by: DJ Omnimaga on September 17, 2014, 11:17:36 pm
Ooh, good job Jens_K :D
Title: Re: Code Golf Contest #10
Post by: Jim Bauwens on September 19, 2014, 01:14:10 pm
Yeah good job! I'm at 98 bytes at the moment (also Nspire-Lua), there is an area where I can get 4 bytes of (regarding an angle) but it causes issues with the interlocking.
Title: Re: Code Golf Contest #10
Post by: ClrDraw on September 19, 2014, 07:41:30 pm
Hey JWinslow, why no pun? :/
Title: Re: Code Golf Contest #10
Post by: JWinslow23 on September 19, 2014, 07:51:50 pm
Hey JWinslow, why no pun? :/
The end of this challenge is drawing near. I'm interested to see what solutions this brings. This challenge is well-rounded, colorful, and bound to be interesting.

There, happy? :P
Title: Re: Code Golf Contest #10
Post by: ClrDraw on September 19, 2014, 08:43:23 pm
Haha XD yes I am.
Title: Re: Code Golf Contest #10
Post by: DJ Omnimaga on September 22, 2014, 02:34:12 am
Hey JWinslow, why no pun? :/
The end of this challenge is drawing near. I'm interested to see what solutions this brings. This challenge is well-rounded, colorful, and bound to be interesting.

There, happy? :P

Never forget about Code Golf. Go finish your entry: Give everything you got. You will be rewarded: Up your score will go!


Better? :P
Title: Re: Code Golf Contest #10
Post by: JWinslow23 on September 22, 2014, 02:52:29 pm
Hey JWinslow, why no pun? :/
The end of this challenge is drawing near. I'm interested to see what solutions this brings. This challenge is well-rounded, colorful, and bound to be interesting.

There, happy? :P

Never forget about Code Golf. Go finish your entry: Give everything you got. You will be rewarded: Up your score will go!


Better? :P

Never go give you up?... Going there, aren't we? To drop so low as that, and you don't even get it right? Give a little more effort this time. You will never make it in the pun industry. Up and away with you! :P
Title: Re: Code Golf Contest #10
Post by: DJ Omnimaga on September 22, 2014, 02:57:35 pm
You can't really start a sentence straight with Going. :P (besides, even the book joke in the funny pic thread didn't get it right), plus making it a question wouldn't make it as necessary to finish an contest entry anymore :P
Title: Re: Code Golf Contest #10
Post by: Adriweb on September 23, 2014, 05:54:55 pm
I don't want to be that guy, but LDStudios' solution doesn't include the "function on.paint(gc)" + "end", which adds a lot of bytes :P
Title: Re: Code Golf Contest #10
Post by: Jim Bauwens on September 24, 2014, 11:53:23 am
The code of JensK is also counted without that... I did not enter because I thought I couldn't beat him but if I would have counted the same way as him my score would 22.2.


I just think that it should be clearer what is counted and what is not :P


My code:


Code: [Select]
function on.paint(g)for i=2,6 do g:setColorRGB(15^i)g:drawArc(i*5,i%2*4,9,9,180-i%2*75,350)end end