code golf

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

code golf

June Kim (김창준)
There was a large developers conference last weekend in Seoul. The
estimated attendants were about 2000.

In the open booth hall, they held a code golf contest. The problem is write
a program that produces(replace _ with blank):

_____*_____
_____*_____
____*_*____
___*___*___
__*_____*__
**_______**
__*_____*__
___*___*___
____*_*____
_____*_____
_____*_____

There is no language restriction. If it's under 150 bytes, you get a latte
and tumbler. There is also a score board that shows top N solutions' code
sizes.

As I remember the first was 73 bytes. He used shell script and gzipped the
output and appended it to the script.

I did it in 30 bytes in J but did'nt participate the contest.

What about you?

sent from an android phone
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
Reply | Threaded
Open this post in threaded view
|

Re: code golf

Marshall Lochbaum-2
Here's 18:

   '_*'{~4=+/~4<.|i:5
_____*_____
_____*_____
____*_*____
___*___*___
__*_____*__
**_______**
__*_____*__
___*___*___
____*_*____
_____*_____
_____*_____
   # '''_*''{~4=+/~4<.|i:5'
18

Marshall

On Tue, Oct 29, 2013 at 11:17:03AM +0900, June Kim (김창준) wrote:

> There was a large developers conference last weekend in Seoul. The
> estimated attendants were about 2000.
>
> In the open booth hall, they held a code golf contest. The problem is write
> a program that produces(replace _ with blank):
>
> _____*_____
> _____*_____
> ____*_*____
> ___*___*___
> __*_____*__
> **_______**
> __*_____*__
> ___*___*___
> ____*_*____
> _____*_____
> _____*_____
>
> There is no language restriction. If it's under 150 bytes, you get a latte
> and tumbler. There is also a score board that shows top N solutions' code
> sizes.
>
> As I remember the first was 73 bytes. He used shell script and gzipped the
> output and appended it to the script.
>
> I did it in 30 bytes in J but did'nt participate the contest.
>
> What about you?
>
> sent from an android phone
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
Reply | Threaded
Open this post in threaded view
|

Re: code golf

Devon McCormick
In reply to this post by June Kim (김창준)
Why didn't you participate in the contest?


On Mon, Oct 28, 2013 at 10:17 PM, June Kim (김창준) <[hidden email]> wrote:

> There was a large developers conference last weekend in Seoul. The
> estimated attendants were about 2000.
>
> In the open booth hall, they held a code golf contest. The problem is write
> a program that produces(replace _ with blank):
>
> _____*_____
> _____*_____
> ____*_*____
> ___*___*___
> __*_____*__
> **_______**
> __*_____*__
> ___*___*___
> ____*_*____
> _____*_____
> _____*_____
>
> There is no language restriction. If it's under 150 bytes, you get a latte
> and tumbler. There is also a score board that shows top N solutions' code
> sizes.
>
> As I remember the first was 73 bytes. He used shell script and gzipped the
> output and appended it to the script.
>
> I did it in 30 bytes in J but did'nt participate the contest.
>
> What about you?
>
> sent from an android phone
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



--
Devon McCormick, CFA
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
Reply | Threaded
Open this post in threaded view
|

Re: code golf

Linda Alvord
In reply to this post by Marshall Lochbaum-2
 What does the ll mean?  I was trying to count the characters in the expression.

   #":'4+5=9'
 11
   ' *'{~4=+/~ 4<.|i:5
     *    
     *    
    * *    
   *   *  
  *     *  
**       **
  *     *  
   *   *  
    * *    
     *    
     *    
   #":' *'{~4=+/~ 4<.|i:5
11


Also:

   #' *'{~4=+/~4<.|i:5
11
   
Linda
-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Marshall Lochbaum
Sent: Monday, October 28, 2013 10:30 PM
To: [hidden email]
Subject: Re: [Jprogramming] code golf

Here's 18:

   '_*'{~4=+/~4<.|i:5
_____*_____
_____*_____
____*_*____
___*___*___
__*_____*__
**_______**
__*_____*__
___*___*___
____*_*____
_____*_____
_____*_____
   # '''_*''{~4=+/~4<.|i:5'
18

Marshall

On Tue, Oct 29, 2013 at 11:17:03AM +0900, June Kim (김창준) wrote:

> There was a large developers conference last weekend in Seoul. The
> estimated attendants were about 2000.
>
> In the open booth hall, they held a code golf contest. The problem is
> write a program that produces(replace _ with blank):
>
> _____*_____
> _____*_____
> ____*_*____
> ___*___*___
> __*_____*__
> **_______**
> __*_____*__
> ___*___*___
> ____*_*____
> _____*_____
> _____*_____
>
> There is no language restriction. If it's under 150 bytes, you get a
> latte and tumbler. There is also a score board that shows top N
> solutions' code sizes.
>
> As I remember the first was 73 bytes. He used shell script and gzipped
> the output and appended it to the script.
>
> I did it in 30 bytes in J but did'nt participate the contest.
>
> What about you?
>
> sent from an android phone
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
Reply | Threaded
Open this post in threaded view
|

Re: code golf

Devon McCormick
To render a literal containing quotes as a string, you have to double the
quote marks in it.  Applying format to Marshall's expression formats its
result, not the expression, i.e.
   $'_*'{~4=+/~4<.|i:5
11 11

versus
   '''_*''{~4=+/~4<.|i:5'
'_*'{~4=+/~4<.|i:5
   #'''_*''{~4=+/~4<.|i:5'
18



On Mon, Oct 28, 2013 at 11:34 PM, Linda Alvord <[hidden email]>wrote:

>  What does the ll mean?  I was trying to count the characters in the
> expression.
>
>    #":'4+5=9'
>  11
>    ' *'{~4=+/~ 4<.|i:5
>      *
>      *
>     * *
>    *   *
>   *     *
> **       **
>   *     *
>    *   *
>     * *
>      *
>      *
>    #":' *'{~4=+/~ 4<.|i:5
> 11
>
>
> Also:
>
>    #' *'{~4=+/~4<.|i:5
> 11
>
> Linda
> -----Original Message-----
> From: [hidden email] [mailto:
> [hidden email]] On Behalf Of Marshall Lochbaum
> Sent: Monday, October 28, 2013 10:30 PM
> To: [hidden email]
> Subject: Re: [Jprogramming] code golf
>
> Here's 18:
>
>    '_*'{~4=+/~4<.|i:5
> _____*_____
> _____*_____
> ____*_*____
> ___*___*___
> __*_____*__
> **_______**
> __*_____*__
> ___*___*___
> ____*_*____
> _____*_____
> _____*_____
>    # '''_*''{~4=+/~4<.|i:5'
> 18
>
> Marshall
>
> On Tue, Oct 29, 2013 at 11:17:03AM +0900, June Kim (김창준) wrote:
> > There was a large developers conference last weekend in Seoul. The
> > estimated attendants were about 2000.
> >
> > In the open booth hall, they held a code golf contest. The problem is
> > write a program that produces(replace _ with blank):
> >
> > _____*_____
> > _____*_____
> > ____*_*____
> > ___*___*___
> > __*_____*__
> > **_______**
> > __*_____*__
> > ___*___*___
> > ____*_*____
> > _____*_____
> > _____*_____
> >
> > There is no language restriction. If it's under 150 bytes, you get a
> > latte and tumbler. There is also a score board that shows top N
> > solutions' code sizes.
> >
> > As I remember the first was 73 bytes. He used shell script and gzipped
> > the output and appended it to the script.
> >
> > I did it in 30 bytes in J but did'nt participate the contest.
> >
> > What about you?
> >
> > sent from an android phone
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



--
Devon McCormick, CFA
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
Reply | Threaded
Open this post in threaded view
|

Re: code golf

June Kim (김창준)
In reply to this post by Devon McCormick
I wanted to, but I was the main organizer of the Alternative Language
Festival, which was a mini conference inside the large one, and I had no
chance to participate. :(

sent from an android phone
2013. 10. 29. 오후 12:33에 "Devon McCormick" <[hidden email]>님이 작성:

> Why didn't you participate in the contest?
>
>
> On Mon, Oct 28, 2013 at 10:17 PM, June Kim (김창준) <[hidden email]>
> wrote:
>
> > There was a large developers conference last weekend in Seoul. The
> > estimated attendants were about 2000.
> >
> > In the open booth hall, they held a code golf contest. The problem is
> write
> > a program that produces(replace _ with blank):
> >
> > _____*_____
> > _____*_____
> > ____*_*____
> > ___*___*___
> > __*_____*__
> > **_______**
> > __*_____*__
> > ___*___*___
> > ____*_*____
> > _____*_____
> > _____*_____
> >
> > There is no language restriction. If it's under 150 bytes, you get a
> latte
> > and tumbler. There is also a score board that shows top N solutions' code
> > sizes.
> >
> > As I remember the first was 73 bytes. He used shell script and gzipped
> the
> > output and appended it to the script.
> >
> > I did it in 30 bytes in J but did'nt participate the contest.
> >
> > What about you?
> >
> > sent from an android phone
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
>
>
>
> --
> Devon McCormick, CFA
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
Reply | Threaded
Open this post in threaded view
|

Re: code golf

June Kim (김창준)
In reply to this post by June Kim (김창준)
Here is mine:

' *'{~(,{:)@|:@|.^:4]4=+/~|i:4

sent from an android phone
2013. 10. 29. 오전 11:17에 "June Kim (김창준)" <[hidden email]>님이 작성:

>
> There was a large developers conference last weekend in Seoul. The
> estimated attendants were about 2000.
>
> In the open booth hall, they held a code golf contest. The problem is
> write a program that produces(replace _ with blank):
>
> _____*_____
> _____*_____
> ____*_*____
> ___*___*___
> __*_____*__
> **_______**
> __*_____*__
> ___*___*___
> ____*_*____
> _____*_____
> _____*_____
>
> There is no language restriction. If it's under 150 bytes, you get a latte
> and tumbler. There is also a score board that shows top N solutions' code
> sizes.
>
> As I remember the first was 73 bytes. He used shell script and gzipped the
> output and appended it to the script.
>
> I did it in 30 bytes in J but did'nt participate the contest.
>
> What about you?
>
> sent from an android phone
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
Reply | Threaded
Open this post in threaded view
|

Re: code golf

David Lambert
In reply to this post by June Kim (김창준)
Latte and tumbler are easily claimed with straightforward

  ' *'{~#:32 32 80 136 260 1539 260 136 80 32 32  NB. 46 characters


How can we compress the integer vector into less than 11 characters?  
Raul has previously shown amazing tricks.  With unicode, if U stands for
a character vector that probably won't pass well
through email but can be typed gives 25 characters.  Absolute value and
minimum crossed my mind as part of a solution.  I didn't think to use i:
.  18 characters---wow.  Nice work to find the function to graph Marshall.

    U =: 4 u:32 32 80 136 260 1539 260 136 80 32 32
    ' *'{~#:3 u:U  NB. with quotes, 25 characters

    #U
11


 >Date: Mon, 28 Oct 2013 22:30:02 -0400
 >To: [hidden email]
 >Subject: Re: [Jprogramming] code golf
 >Message-ID: <[hidden email]>
 >
 >Here's 18:
 >
 >   '_*'{~4=+/~4<.|i:5

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
Reply | Threaded
Open this post in threaded view
|

Re: code golf

slocklin
In reply to this post by June Kim (김창준)
Marshall wrote:

> Here's 18:

>   '_*'{~4=+/~4<.|i:5

Dang: 18 bytes. FWIIW, the Shannon information in the generated string is ... about 17 bytes. Kolomogorov is arguably smaller (and of course, the 12 byte train produces the same information), but that's really damn cool.

-Scott
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm