05-24-2005, 09:56 PM
ok now i got it. i added another checker to see if there were any repeats after i dealed them that would print out were the repeated cards were so i didnt have to check it all the time
Code:
declare function rndcard$()
cls
np=4 'Number of players. change to your needs
'dims the player array
'the first d is the number of players
'the second d is the number of in wich he gets the card
'(sorry cant explain think of any other way to explain that)
dim player$(np,52)
randomize timer
for p=1 to np ' does for number of players
for i=1 to (52/np) ' divides the deck
1
player$(p,i) = rndcard$() ' gets the card
for a= 1 to np
for n = 1 to (52/np) 'this checks to make
if a=p and n=i then n=n+1
if player$ (p,i) = player$(a,n) then goto 1'sure the card isnt
next 'repeated
next
next
next
'the rest of this prints out the player and card names
c=1
oldp=0
for p=1 to np
r=1
locate r,c: print "Player "; p
r=r+1
for i= 1 to (52/np)
r=r+1
locate r,c: print player$(p,i)
next
c=c+18
next
'this just checks to make sure that there are no repeats
y=20
for p=1 to np
for pa=1 to np
for i=1 to 53/np
for n=1 to 53/np
if player$(p,i)=player$(pa,n) then
if p<>pa and n<>i then
locate y,1: print "error @ player ";p;" card number ";i;" = player ";pa;" card number ";n;
y=y+1
end if
end if
next
next
next
next
do:loop until inkey$=chr$(27)
function rndcard$()
SS=int(rnd*4)+1 'this is selects the suit
card=int(rnd*13)+1 ' this selects the card number
'names the suits
select case SS
case 1
suit$="Spades"
case 2
suit$="Clubs"
case 3
suit$="Diamonds"
case 4
suit$="Hearts"
end select
'selects the card names
select case card
case 1
cname$="Ace"
case 11
cname$="Jack"
case 12
cname$="Queen"
case 13
cname$="King"
case else
cname$=str(card)
end select
rndcard$=cname$ + " of " + suit$ 'puts it all together
end function
his world has been connected...
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless