Yes, that's a nice example of J, although that example leaves each hand
in its shuffle order. The Rosetta task doesn't require reordering
within hands.
No advance on the J front hereafter, just a link to a Bridge fan's view.
This site claims (I think) to display any possible Bridge deal (!):
https://bridge.thomasoandrews.com/impossible/
The title is "The Impossible Bridge Book", his/their point being that they
can efficiently index or access any of the huge number of all deals
I entered page number 1234, as good as any, perhaps.
The "Show work" option reveals the hands in this intermediate form:
Result:
NorthCardNumbers = [0,1,2,3,4,5,6,7,8,9,10,11,12]
EastCardNumbers = [13,14,15,16,17,18,19,20,21,22,23,24,25]
SouthCardNumbers = [26,27,28,29,31,32,34,35,37,38,39,41,42]
WestCardNumbers = [30,33,36,40,43,44,45,46,47,48,49,50,51]
Evidently, 0-12=A-2 spades, 13-25=A-2 hearts, 26-38=A-2 diamonds,
39-51=A-2 clubs.
He shows ten as "10" rather than "T"
The final result is a graphic which might not reproduce well here, but
I'll try:
Page 1234
♠ AKQJ1098765432
♥ —
♦ —
♣ —
♠ —
♥ —
♦ 1074
♣ K1098765432
♠ —
♥ AKQJ1098765432
♦ —
♣ —
♠ —
♥ —
♦ AKQJ986532
♣ AQJ
Apologies if this displays poorly. Perhaps 1234 wasn't the best choice
for a good game!
Mike
On 15/10/2018 01:56, Ric Sherlock wrote:
I haven't followed this thread very closely so am not sure how useful the
following will be, but this Rosetta Code link may be of interest.
http://rosettacode.org/wiki/Playing_cards#J
On Sun, Oct 14, 2018 at 12:47 PM Linda Alvord <lindaalvor...@outlook.com>
wrote:
This should now work in most J environments.
F=:52$'23456789TJQKA'
S=:13#u: 9824 9829 9830 9827
deck=:S,.F
shuf=: 13 :'<"2|."2 y {~ /:~"1 (|.x)$?~*/|.x
Save code above in a file and then run the script.
Here's how it looks in android.
13 4 shuf deck
┌──┬──┬──┬──┐
│♣A│♣J│♣K│♣9│
│♣Q│♣6│♣T│♣3│
│♦K│♣5│♣8│♦A│
│♦T│♣4│♣7│♦J│
│♦9│♣2│♦Q│♦8│
│♦6│♦2│♦7│♥K│
│♥A│♥Q│♦5│♥6│
│♥T│♥J│♦4│♥3│
│♥8│♥9│♦3│♠A│
│♥7│♥4│♠Q│♠K│
│♥5│♥2│♠T│♠9│
│♠8│♠J│♠7│♠6│
│♠5│♠2│♠3│♠4│
└──┴──┴──┴──┘
Linda
Sent from my Verizon, Samsung Galaxy smartphone
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm