110 characters.

,/,./"3(3 3$,0,.1+i.4){' ',({.&>({.,': ',}.
\:b i.}.)/.&(r&,)"1{:&>)_13]\(?~52){,{'r b'
=.;:'SHDC 23456789TJQKA'

readable version:

f2=: 3 : 0
 'r b'=. ;:'SHDC 23456789TJQKA'
 d=. _13]\(?~52){,{r;b
 e=. ({.&> ({.,': ',}.\:b i.}.)/.&(r&,)"1 {:&>) d
 ,/,./"3 (3 3$,0,.1+i.4){' ',e
)



----- Original Message -----
From: Dan Bron <[EMAIL PROTECTED]>
Date: Tuesday, August 29, 2006 8:58 am
Subject: [Jprogramming] Dealing a bridge hand

> Let's play a little J golf.  I'll present the first challenge, the 
> winner of that challenge  gets to present the next. 
> 
> An old standby: the bridge hand.  Find the shortest J sentence 
> that deals a random bridge hand and formats it like this:
> 
>                     S: AQJ83
>                     H: KJ6
>                     D: 5
>                     C: AQJ5
>       
>       S: T6542                S: 9
>       H: AT                   H: 974
>       D: QT762                D: A983
>       C: 4                    C: K9732
>       
>                     S: K7
>                     H: Q8532
>                     D: KJ4
>                     C: T86
> 
> 
> Here's my tee-off:
> 
>           ,.&:>/<@(,/)@:>"1]3 3$(9$a:)(1 3 5 7)}~<@:>"1
>           ({:&><@({.,': ',(}.\:b i.}.))/.&:(r&,)"1~{.&>)
>           (-#b)]\([EMAIL PROTECTED]),{'r b'=.;:'SHDC 23456789TJQKA'
> 
> That's all one line, and it's composed of 137 characters.


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

Reply via email to