Card shuffling emulator

thelonliestmonk's icon

Hello.

Im an Audio Technology student new to Max MSP and having trouble with trying to create a patch which mimics the shuffling and dealing of a pack of cards.

I used the Urn object to mimic dealing out 52 cards without repetition and then used the select tool to print messages/display images when a certain number is dealt.
i.e 0 triggers Ace of Hearts message and image, 1 triggers 2 of Hearts message and image etc. etc.

Im also using the capture object to capture the numbers drawn to mimc the deck being put together again.

So now I need a way to shuffle the contents of the capture window and then deal out the sequence left after the shuffle.
Any Ideas?

Im quite new to all of this so might be a bit slow but if you can mention any keywords or topics for me to look at then that would help too. Any help at all would be appreciated.

Salutations

Eli's icon

I think that instead of "shuffling" the contents of capture you could re-use [urn] and achieve the same effect- or perhaps utilize [coll]- send the data from [capture] to coll and then work with it from there- it has much more functionality than [capture]. Also take a look at [urn-jb], which is the same as [urn], except that it maintains that there will never be repeats of numbers (which you may or may not want). Hope that helps!

Eli

Luke Hall's icon

You might want to try dealing with lists where you can use [zl scramble] to shuffle and [zl slice] to cut cards out of the deck. You can also use [% 13] and [/ 13] from the 0-51 card index to figure out the value and suit.

lh

Mike S's icon
thelonliestmonk's icon

Mike S. - Thanks for the patch but its a little too helpful if you know what i mean.

thereishopeforus - THanks for pointing in me in the direction of lists as i think this might be the way forward.

stine.eli@gmail.com - Thanks for the input but dont really understand the coll function. Do you think this would be a good way forward? From the description It says that the data can be edited but it is going over my head a bit.

Im now using a list and the zl scramble object for the initial randomization of the pack. But im still stuck on mimicing a real human shuffle.

I know I need to select a random amount of cards say somewhere between 1 and 10 and I have to drop that group of cards back into the remainder of the pack at a random point. I feel if this was done say 10 times it would mimic a light overhand shuffle.

Can split the pack using zl slice and a a random number generator but do not know how to insert the split back into the other half of the deck (or other list). Tried using the zl join object but doesnt seem to be rejoining my list in the way I want it to.
I.e. it seems to assimilate the two lists together at random rather than dropping the smaller list into another.
Maybe I am misunderstanding the zl join object?

THanks for all the tips so far and if anyone reads this and has an idea then feel free to help.

Salutations

Luke Hall's icon

The [zl slice] object joins one list to the end of the other. You'll need to use a [zl slice] to split the original list and then [zl join] twice to piece the three lists back together. In the case below the list is inserted after the fourth item as per the "4" argument.

lh

Max Patch
Copy patch and select New From Clipboard in Max.

thelonliestmonk's icon

I apologise for my ignorance but dont know how to make sense of that text you pasted at the bottom of your reply.
Im assuming that the text represents a max patch but how can I look at it as a patch rather than plain text?

goodparleyandorfing's icon