The responsed you gave are basically correct.  Here are a few thoughts.  My
initials are  la  so when you make you statements, remove my initials and
then add yours. This will avoid a lot of typing.  It also makes it possible
to keep track of different ideas.

Your  pack  is a little difficult to compare with the  dole  which is why I
had a more horizontal arrangement, but if you prefer the vertical that is
readable as well.

The problem is whith your dole.  Nine of Hearts and Five of Clubs are your
first two cards.  The Nine of Hearts goes in the first hand.  The Five of
Clubs in that mix of cards would be the first card dealt into the second
hand. Your are trying to simulate a real deal of the cards so you continue
third card to third hand and so forth.  By showing two deals, you establish
that the cards have really been shuffled and then are dealt correctly.  You
have made a deal as it should be.  The real problem is that it doesn't match
this shuffle.

    dolelardm mixed=: mixlardm packlardm
865KJKQAT9236
SSHCDDHHDHSHH

A447JJ96KT56Q
CHSSHCDDHSSCS

Q2A3738Q37A57
DCDCDDHCSCSCH

4J92458KT98T2
CSSDDDCSHCDCH
   mixed
9H
5C
7C
3D
9D
7S
9S
3S
3C
KC
6C
TS
QD
TD
2S
4S
4D
JH
TH
9C
KD
AH
QC
TC
2D
JD
5H
4C
JS
3H
2H
7D
QH
AD
AC
JC
6H
5D
7H
QS
8C
AS
8D
8H
KH
8S
6S
4H
KS
6D
5S
2C
 
I'll try to be more clear with the instructions in the future.

Linda 

-----Original Message-----
From: programming-boun...@jsoftware.com
[mailto:programming-boun...@jsoftware.com] On Behalf Of Raul Miller
Sent: Thursday, January 05, 2012 1:45 PM
To: Programming forum
Subject: Re: [Jprogramming] Challenge 3 - Dole a Mixed Pack

On Thu, Jan 5, 2012 at 9:47 AM, Linda Alvord <lindaalv...@verizon.net>
wrote:
> I'm not sure this if this challenge was too hard or too
> easy. Since no one responded, ...

Personally, I find the embargo requirement daunting.  I also had some
trouble with the way you had phrased the task -- I sent an email about
some of those issues, and received no response.

That said, with a concrete example of what you are looking for, I can
provide workalikes and comments.

   packla=: |.|:,/'SHDC',"0/'AKQJT98765432'
   packlardm=: >,{'AKQJT98765432';'SHDC'

(I like the rdm version better but you might not accept it.)

   mixlardm=: {~ [:?~#
   mixla=:    {~"1 [:?~_1{$

   mixla packla
559Q46388T79J6QTAAJ4KTAK2T42Q645776598KA3Q9J2J3287K3
CSHHCHDHSHDCDCDDCHHHHCDSSSSCSDDDSCSHDCDSHCSCHSSDDHCC
   |:mixlardm packlardm
J3K9QAT3722KJ4A85849K926Q35TJ86A35T768QT7J675Q294K4A
HSSCDHSDDCDDDDSHSCCDHSSSHCCDCSCCHHHHHDCCCSDSDSHHHCSD

Note that your original instructions were unclear about the role of
the left argument for mixla.  It's clear now that you do not use the
left argument.  That said, neither of my above definitions will ignore
the left argument.  For that, use:

   mixlardm=: ]{~ [:?~ [:# ]
   mixla=:    ]{~"1 [:?~ _1{ [:$ ]

However, in my opinion, this kind of a "you must handle a left
argument by ignoring it" thing smells bad.  It complicates that code
and thus makes future revisions more difficult and makes understanding
the code harder.

   dolela=: _13 ]\ mixla
   dolelardm=: _13 |:\ mixlardm

   dolela packla
...
   dolelardm packlardm
...

Or, if you want extra shuffles (though it's not clear if they do
anything meaningful):

   dolelardm mixlardm^:2 packlardm

(results omitted here for brevity).

-- 
Raul
----------------------------------------------------------------------
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 via email to