Sdince I still can't start a new thread, if you answer this, please chane th 
subject to: 
"bridge to poker"

This will deal 3 cards to six players:

S=:13#u: 9827 9830 9829 9824  
   F=:52$'23456789TJQKA'
   deck=:S,.F 
   
   bridge=: 13 :'<"2(\:~(|.x)$?~*/x){y'
   
   3 6 bridge deck
┌──┬──┬──┬──┬──┬──┐
│♦2│♣A│♣J│♣9│♣6│♣4│
│♣T│♦3│♣7│♣8│♦5│♣3│
│♣K│♦4│♣5│♣2│♣Q│♦6│
└──┴──┴──┴──┴──┴──┘

However in poker, the cafds have different values.
Since I don't know much about poker, I'm throwing in my hand.

Linda



-----Original Message-----
From: Programming <programming-boun...@forums.jsoftware.com> On Behalf Of Linda 
Alvord
Sent: Friday, October 26, 2018 11:18 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Shuffle and deal 4 bridge hands



Here's the simplest I can get thisL:   S=:13#u: 9827 9830 9829 9824  
   F=:52$'23456789TJQKA'
   deck=:S,.F 
   
   13 4 bridge deck
┌──┬──┬──┬──┐
│♠J│♠A│♠9│♠3│
│♠8│♠K│♠5│♥A│
│♠7│♠Q│♥4│♥K│
│♠6│♠T│♥2│♥Q│
│♠4│♠2│♦A│♥J│
│♥6│♥3│♦Q│♥T│
│♥5│♦5│♦J│♥9│
│♦K│♣Q│♦9│♥8│
│♦7│♣T│♦4│♥7│
│♦3│♣9│♣K│♦T│
│♦2│♣8│♣6│♦8│
│♣A│♣5│♣4│♦6│
│♣J│♣2│♣3│♣7│
└──┴──┴──┴──┘
   bridge
[: <"2 ] {~ [: \:~"1 ([: |. [) $ [: ?~ [: */ [
   
   ;:'[: <"2 ] {~ [: \:~"1 ([: |. [) $ [: ?~ [: */ ['
┌──┬─┬─┬─┬─┬─┬─┬──┬──┬─┬─┬─┬─┬──┬──┬─┬─┬─┬──┬─┬─┬──┬─┬─┬─┐
│[:│<│"│2│]│{│~│[:│\:│~│"│1│(│[:│|.│[│)│$│[:│?│~│[:│*│/│[│
└──┴─┴─┴─┴─┴─┴─┴──┴──┴─┴─┴─┴─┴──┴──┴─┴─┴─┴──┴─┴─┴──┴─┴─┴─┘
      
   
Read the "words" from right to left to right to see how [: helps you tell 
monadic verbs from dyadic ones.  Also note the impact of  /  and  ~  on the 
meaning of the verb to its left.

Linda

-----Original Message-----
From: Programming <programming-boun...@forums.jsoftware.com> On Behalf Of 'Mike 
Day' via Programming
Sent: Monday, October 15, 2018 11:27 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Shuffle and deal 4 bridge hands

!52 is the number of all possible deck shuffles.

The sort-order of a bridge hand as dealt is immaterial to the player.

(!52)%*/4#!13 is 53644737765488792839237440000, which, as you mention,

is the cited number of different deals ignoring ordering within each hand.

Both results are correct in their different ways!

M



On 15/10/2018 16:06, Linda Alvord wrote:
>   Bridge ppage:
>
>
>
> 53,644,737,765,488,792,839,237,440,000 to unique bridge deals.
>
>     J :
>
> !52
> 8.06582e67
>
>
> Not much agreement.
>
> Linda
>
>
>
>
>     ,
> Sent from my Verizon, Samsung Galaxy smartphone
> -------- Original message --------
> From: 'Mike Day' via Programming <programm...@jsoftware.com>
> Date: 10/14/18 1:45 PM (GMT-05:00)
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] Shuffle and deal 4 bridge hands
>
> Sorry - getting rather chatty,  not much J - your deck, Linda, has 
> faces increasing within decreasing suits,  given that Bridge has the 
> ordering spade > heart > diamond > club , so your shuffle produces 
> suits in the "wrong" order.
> So redefining deck as (say):
>      [suits =: |. u: 9824 9829 9830 9827 NB. increasing ♣♦♥♠
> faces =: '23456789TJQKA'   NB. increasing
> |:each (5&{.;_5&{.) deck =:,/suits,"0/faces NB. all increasing
> ┌─────┬─────┐
> │♣♣♣♣♣│♠♠♠♠♠│
> │23456│TJQKA│
> └─────┴─────┘
>
> NB. for a set of Whist hands: (actually done here with ?. rather than ?)
>       7 (]<"2 @: {~ \:~"1 @: ((4 , [) ($ ? ~@:#) ])) deck 
> ┌──┬──┬──┬──┐ │♥A│♠K│♠A│♠T│ │♥T│♠4│♠Q│♠5│ │♥2│♦5│♠8│♥J│ │♦T│♦4│♠6│♦9│ 
> │♣Q│♦2│♥K│♦8│ │♣3│♣A│♥7│♣K│ │♣2│♣T│♦J│♣6│ └──┴──┴──┴──┘
>
> Use lh arg of 13 for Bridge Hands.
>
> The down-sort is now intuitive, and we don't need to reverse each 
> column
>
> Cheers,
>
> Mike
>
> On 14/10/2018 16:27, 'Mike Day' via Programming wrote:
>> Sorry for previous - pressed Send instead of Edit!
>>
>> Thanks, Linda
>>
>> No problems under Windows 10 in JQt 807.
>>
>> I'm no good at Bridge, but might be persuaded to play whist!
>>
>> If we want to choose Whist or Bridge,  we need to specify the
>>
>> size of a hand.  In either case, you can use draw from the row-count
>>
>> of deck rather than the product of x.
>>
>> This consideration and some other slight changes lead to:
>>
>>     shuffle =: 13 : '<@|."2 y{~ /:~"1 x$&|. ?~#y'
>>
>> SO, for a game of Whist:
>>
>>     7 4 shuffle deck
>> ┌──┬──┬──┬──┐
>> │♣8│♦7│♣6│♦A│
>> │♣2│♥6│♦Q│♦K│
>> │♦J│♥5│♦6│♦T│
>> │♦9│♥4│♥T│♥A│
>> │♦8│♥3│♥7│♥2│
>> │♥8│♠Q│♠J│♠K│
>> │♠4│♠9│♠3│♠8│
>> └──┴──┴──┴──┘
>>
>> OR - can't we assume 4 suits? -
>>     7 (13 :'<@|."2 y{~ /:~"1 (4,x)$ ?~#y') deck ┌──┬──┬──┬──┐ 
>> │♣A│♦K│♣Q│♣J│ │♣6│♦5│♣2│♣8│ │♦Q│♥K│♦A│♣7│ │♦T│♥Q│♦7│♣3│ │♥A│♥8│♥7│♦J│ 
>> │♥2│♥3│♥5│♥6│ │♠7│♠2│♠5│♠Q│ └──┴──┴──┴──┘
>>
>> Cheers,
>> Mike
>>
>> On 14/10/2018 00:47, Linda Alvord 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 
>>> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
>>> .jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7Ce8f992fdd9964b471a
>>> bc08d632b2aa00%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63675214
>>> 0271106545&amp;sdata=l9T9k5TfBMaf5WY8whn0VlQcGq4wbbPCwS%2Fv0%2FZkliM
>>> %3D&amp;reserved=0
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.
> avast.com%2Fantivirus&amp;data=02%7C01%7C%7Ce8f992fdd9964b471abc08d632
> b2aa00%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636752140271106545
> &amp;sdata=tCcJS4FCriXzsSK%2FdxWD3gAm1CtYnkAvLWBwRrw65eo%3D&amp;reserv
> ed=0
> ----------------------------------------------------------------------
> For information about J forums see
> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j
> software.com%2Fforums.htm&amp;data=02%7C01%7C%7Ce8f992fdd9964b471abc08
> d632b2aa00%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63675214027110
> 6545&amp;sdata=l9T9k5TfBMaf5WY8whn0VlQcGq4wbbPCwS%2Fv0%2FZkliM%3D&amp;
> reserved=0
> ----------------------------------------------------------------------
> For information about J forums see
> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j
> software.com%2Fforums.htm&amp;data=02%7C01%7C%7Ce8f992fdd9964b471abc08
> d632b2aa00%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63675214027110
> 6545&amp;sdata=l9T9k5TfBMaf5WY8whn0VlQcGq4wbbPCwS%2Fv0%2FZkliM%3D&amp;
> reserved=0



---
This email has been checked for viruses by Avast antivirus software.
https://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.avast.com%2Fantivirus&amp;data=02%7C01%7C%7C32155b8825724db7d13608d63b563695%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636761638808517041&amp;sdata=izLg6frOcz%2BfdFGDc2EeNWaCA6GXjmKiBkyj%2BfBivqg%3D&amp;reserved=0
----------------------------------------------------------------------
For information about J forums see 
https://eur04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7C32155b8825724db7d13608d63b563695%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636761638808517041&amp;sdata=nh6FprZ9fvrAOHEoqEDTHgrkIEAcEz0YztPPyGkQmz8%3D&amp;reserved=0
----------------------------------------------------------------------
For information about J forums see 
https://eur04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7C32155b8825724db7d13608d63b563695%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636761638808517041&amp;sdata=nh6FprZ9fvrAOHEoqEDTHgrkIEAcEz0YztPPyGkQmz8%3D&amp;reserved=0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to