I think I've asked this before, but I'll throw it out again and see what happens....
Ok, imagine you're writing a program to shuffle a pack of cards.
Let's say the cards are simply numbered 1-52 and you have a program further down the line to convert an integer X to a face value and suit given X:52>=X>=1.
You have a standard random number generator, let's say
Rand(X)
Which will return a random integer between 0 and X
You can have as many arrays as you want, say:
Array deck = int[52]
Which will produce an array "deck" with elements from 0-51.
You can index into the array with .variable e.g:
int deal = deck.cardnumber
Makes sense?
Ok, now write a piece of pseudo code describing an algorithm which will deal a shuffled deck of cards.
I noticed you wrote a card game, so you'll be good at this! It took me quite a long time to think of something you'd be good at. :-)
Ok, off you go then.... anybody that is. Programmers, non programmers.....
The question is: How do you write a program which deals a shuffled deck of cards?