Hi guys, I'm trying to create a blackjack game. I've run into a spot of trouble with the card drawer. See, I have (in my infinite newbieness) absolutely no idea on how to make a pool of numbers. I've got a crude method of having 20 letters be a small memory of up to 20 cards already drawn, but it's ridiculously repetitive and long. How can I create a pool of numbers, to add to every time a card is drawn, so you can draw a card and not get it again?
Heres a fast way to make 20 random cards. with numbers 1-13
:20→dim(L1 :For(X,1,20 :randint(1,13 :Ans→L1(X) :End
should it not be:
or do i misunderstand the purpose of "1+" ?
EDIT: i see, you are ceiling the random number, hehe nice trick! but a neccesary one otherwise you would get 0's
@ paintballnoob: in case you don't understand builderboy's code, let me explain:
with rand you generate a pseudonumber, in short, anything below, 1 he multiplies this number by 13 adds one to it (to prevent it from becoming 0) takes the ipart (or left part) of the decimal number and does this whole procces 20 times.
Why not use randInt('s third argument?
EDIT: It appears that builderboy's code is the same size as mine. How peculiar…
Hey I should get some credit =[ At least I put more then "use lists" lol.
Heres how to make the card with the number and suit.
:randint(1,13,20→L1 :randint(1,4,20)/10→L2 :L1+Ans→L1
After that stores the cards you can use fpart( to get the suit. 1 hearts 2 spades 3 clubs 4 diamonds