| 05-12-2005, 01:20 PM | #1 |
Problem: Card deck Hi, just wondering if you had any solution to this problem, making a carddeck. Not that I want a card deck but it describes the problem. first: Say I want 3 strings with text.. "Hi", "Hello" and "Goodbye".. Say that I have 3 players, they will get the text randomly, but the text can only be shown to one person.. uhm.. Say if player 1 gets the message "Hi", then player 2 or 3 cant get the message "Hi", they will randomly get either the message "Hello" or "goodbye" Like a card deck, when a player gets a card the card cant be given to any other player.. Thats my problem, and I cant find a solution to that! :S I hope this trigger is possible in GUI |
| 05-12-2005, 07:08 PM | #2 |
ahh i remember back in grade 11 doing something like this for school anyways, i'm almost certain this is -not- the best way to do this, its just the first thing i came up with so i'm going with it a = maxcards b = cardsleft c = selectedcard card[] = an array of sometype, with each element being a different possibility Code:
b = a
for intB = 0 to (a - 1)
c = (Random integer from 0 to b)
//Stuff in here
//Give card index c (you'd have an array of whatever (strings) )
//in your case i guess intB would be not so high and it would be the player reference
b = b - 1
for intA = c to b
card[intA] = card[intA + 1]
endloop
endloopagain, prob not the best way, waiting for someone to come and put something better :p |
