@Smart Guy
Quote: "note: it looks like crap in DBC, but thats cuz im doing it in pro "
Careful with your wording. You programmed the code less compatible with DBC. You are using the same 2d graphics.
For DBC the font character set is important. Change your symbol fonts to Set Text Font "Symbol",2 and change your arial to
Set Text Font "arial",1
To fill an ellipse, use two of them and offset them slightly:
for yrad=200 to 0 step -1
ellipse 320,240,yrad+50,yrad
ellipse 320,241,yrad+50,yrad
next yrad
And Voila:
sync on : hide mouse
gosub init_stuff
`------------------------------------------------------
`MAIN LOOP
`------------------------------------------------------
do
`I'm using 0,0 as a flag for telling if the cards have been dealt
if PlayerCardData(0,0)=0
gosub DealCards
gosub ShowTable
else
if mouseclick()=1 then gosub ShowTable
endif
sync
loop
`------------------------------------------------------
`SUBROUTINES
`------------------------------------------------------
init_stuff:
`make table image
table_pic=100
ink rgb(0,255,0),0
for yrad=200 to 0 step -1
ellipse 320,240,yrad+50,yrad
ellipse 320,241,yrad+50,yrad
next yrad
get image table_pic,0,0,640,480
cls
`make cards
set text font "Symbol",2
set text size 15
cls rgb(255,255,255)
imagenum=200
for number=2 to 14
if number<11
value$=" " + str$(number)
else
select number
case 11 : value$=" J" : endcase
case 12 : value$=" Q" : endcase
case 13 : value$=" K" : endcase
case 14 : value$=" A" : endcase
endselect
endif
for suit=1 to 4
if suit>1 and suit<4
ink rgb(255,0,0),0
else
ink rgb(0,0,0),0
endif
if number=11 or number=12 : set text font "arial",1 : else : set text font "symbol",1 : endif
print value$
set text font "symbol",2
print " " + chr$(166+suit)
get image imagenum,0,0,20,30
inc imagenum
cls rgb(255,255,255)
next suit
next number
ink rgb(255,0,0),0
set text size 30
center text 10,2,"?"
get image 199,0,0,20,30
`make variables/arrays
dim PlayerCardData(8,2,2)
CardValue=1
CardSuit=2
dim TableCards(5,2)
TableCards(0,0)=-1
dim CardStatus(14,4)
dim PlayerChips(8)
for player=1 to 8 : PlayerChips(player)=2000 : next player
return
DealCards:
for player=1 to 8
for card=1 to 2
repeat
randomize timer()+rnd(100)
value=rnd(12)+2
suit=rnd(3)+1
until CardStatus(value,suit)=0
CardStatus(value,suit)=1
PlayerCardData(player,card,CardValue)=value
PlayerCardData(player,card,CardSuit)=suit
next card
next player
for card=1 to 5
repeat
randomize timer()+rnd(100)
value=rnd(12)+2
suit=rnd(3)+1
until CardStatus(value,suit)=0
CardStatus(value,suit)=1
TableCards(card,CardValue)=value
TableCards(card,CardSuit)=suit
next card
`I'm using 0,0 as a flag for telling if the cards have been dealt
PlayerCardData(0,0)=1
return
ShowTable:
set text font "Arial",1
set text size 20
ink rgb(255,255,255),0
paste image table_pic,0,0
for player=1 to 8
if player=1 : string$=" You-"+str$(PlayerChips(player)) : else : string$=str$(PlayerChips(player)) : endif
center text 320+cos((player-1)*45)*250,240+sin((player-1)*45)*200,string$
paste image get_card_image(PlayerCardData(player,1,CardValue),PlayerCardData(player,1,CardSuit)),275+cos((player-1)*45)*250,230+sin((player-1)*45)*200
paste image get_card_image(PlayerCardData(player,2,CardValue),PlayerCardData(player,2,CardSuit)),365+cos((player-1)*45)*250,230+sin((player-1)*45)*200
next player
TableCards(0,0)=TableCards(0,0)+1
if TableCards(0,0)>0
paste image get_card_image(TableCards(1,1),TableCards(1,2)),270,215
paste image get_card_image(TableCards(2,1),TableCards(2,2)),295,215
paste image get_card_image(TableCards(3,1),TableCards(3,2)),320,215
else
paste image 199,270,215
paste image 199,295,215
paste image 199,320,215
endif
if TableCards(0,0)>1
paste image get_card_image(TableCards(4,1),TableCards(4,2)),345,215
else
paste image 199,345,215
endif
if TableCards(0,0)>2
paste image get_card_image(TableCards(5,1),TableCards(5,2)),370,215
else
paste image 199,370,215
endif
center text 550,450,read_hand_value$(get_hand_value(1))
repeat
until mouseclick()=0
return
`------------------------------------------------------------------
`FUNCTIONS
`------------------------------------------------------------------
function get_card_image(value,suit)
imagenum=199+(4*(value-2))+suit
endfunction imagenum
function card_value$(value)
if value<11
value$=str$(value)
else
select value
case 11 : value$="J" : endcase
case 12 : value$="Q" : endcase
case 13 : value$="K" : endcase
case 14 : value$="A" : endcase
endselect
endif
exitfunction value$
endfunction ""
function get_hand_value(player)
dim suits(4) : dim values(14) : dim cardflags(14,4)
for suit=1 to 4 : suits(suit)=0 : next suit
for value=2 to 14 : values(value)=0 : next value
for value=2 to 14 : for suit=1 to 4 : cardflags(value,suit)=0 : next suit : next value
a1=0 : a2=0 : b1=0 : b2=0 : c1=0 : c2=0 : d1=0 : d2=0 : e1=0 : e2=0 : f1=0 : f2=0 : g1=0 : g2=0
a1=PlayerCardData(player,1,1) : a2=PlayerCardData(player,1,2)
b1=PlayerCardData(player,2,1) : b2=PlayerCardData(player,2,2)
if TableCards(0,0)>0
c1=TableCards(1,1) : c2=TableCards(1,2)
d1=TableCards(2,1) : d2=TableCards(2,2)
e1=TableCards(3,1) : e2=TableCards(3,2)
endif
if TableCards(0,0)>1
f1=TableCards(4,1) : f2=TableCards(4,2)
endif
if TableCards(0,0)>2
g1=TableCards(5,1) : g2=TableCards(5,2)
endif
for value=2 to 14
number=0
if a1=value then inc number
if b1=value then inc number
if c1=value then inc number
if d1=value then inc number
if e1=value then inc number
if f1=value then inc number
if g1=value then inc number
values(value)=number
next value
for suit=1 to 4
number=0
if a2=suit then inc number
if b2=suit then inc number
if c2=suit then inc number
if d2=suit then inc number
if e2=suit then inc number
if f2=suit then inc number
if g2=suit then inc number
suits(suit)=number
next suit
cardflags(a1,a2)=1
cardflags(b1,b2)=1
cardflags(c1,c2)=1
cardflags(d1,d2)=1
cardflags(e1,e2)=1
cardflags(f1,f2)=1
cardflags(g1,g2)=1
`check for straight flush:
for suit=1 to 4
for lowvalue=2 to 10
if cardflags(lowvalue,suit)=1
if cardflags(lowvalue+1,suit)=1
if cardflags(lowvalue+2,suit)=1
if cardflags(lowvalue+3,suit)=1
if cardflags(lowvalue+4,suit)=1
exitfunction 9000+lowvalue
endif
endif
endif
endif
endif
next lowvalue
next suit
`check for four of a kind
for value=2 to 14
if values(value)=4 then exitfunction 8000+value
next value
`check for full house
for value1=14 to 2 step -1
if values(value1)=3
for value2=14 to 2 step -1
if value2<>value1
if values(value2)=2
if value1<value2
exitvalue=7000+(20*value2)+value1
exitfunction exitvalue
else
exitvalue=7000+(20*value2)+value1
exitfunction exitvalue
endif
endif
endif
next value2
endif
next value1
`check for flush
for suit=1 to 4
if suits(suit)>=5
for highcard=14 to 6 step -1
if cardflags(highcard,suit)=1
exitfunction 6000+highcard
endif
next highcard
endif
next suit
`check for straight
for highcard=14 to 5 step -1
if highcard>5
if values(highcard)>0
if values(highcard-1)>0
if values(highcard-2)>0
if values(highcard-3)>0
if values(highcard-4)>0
exitfunction 5000+highcard
endif
endif
endif
endif
endif
else
if values(highcard)>0
if values(highcard-1)>0
if values(highcard-2)>0
if values(highcard-3)>0
if values(14)>0
exitfunction 5000+highcard
endif
endif
endif
endif
endif
endif
next highcard
`check for trips
for value=14 to 2 step -2
if values(value)=3
exitfunction 4000+value
endif
next value
`check for two pair
for value1=14 to 2 step -1
if values(value1)=3
for value2=14 to 2 step -1
if value2<>value1
if values(value2)=2
if value1<value2
exitvalue=3000+(20*value2)+value1
exitfunction exitvalue
else
exitvalue=3000+(20*value2)+value1
exitfunction exitvalue
endif
endif
endif
next value2
endif
next value1
`check for pair
for value=14 to 2 step -1
if values(value)=2
exitfunction 2000+value
endif
next value
`check for high card
for value=14 to 2 step -1
if values(value)>0
exitfunction 1000+value
endif
next value
endfunction 0
function read_hand_value$(handvalue)
if handvalue>9000
if handvalue=9010
exitfunction "Royal Flush!"
else
exit$="Straight Flush, "+card_value$(handvalue-9000+4)+" high"
exitfunction exit$
endif
endif
if handvalue>8000 and handvalue<9000
exit$="Four of A Kind, "+card_value$(handvalue-8000)+"s"
exitfunction exit$
endif
if handvalue>7000 and handvalue<8000
if handvalue>7020 and handvalue<7040
value$ = "Full House, 3s over "+card_value$(handvalue-7020)+"s"
endif
if handvalue>7040 and handvalue<7060
value$ = "Full House, 4s over "+card_value$(handvalue-7040)+"s"
endif
if handvalue>7060 and handvalue<7080
value$ = "Full House, 5s over "+card_value$(handvalue-7060)+"s"
endif
if handvalue>7080 and handvalue<7100
value$ = "Full House, 6s over "+card_value$(handvalue-7080)+"s"
endif
if handvalue>7100 and handvalue<7120
value$ = "Full House, 7s over "+card_value$(handvalue-7100)+"s"
endif
if handvalue>7120 and handvalue<7140
value$ = "Full House, 8s over "+card_value$(handvalue-7120)+"s"
endif
if handvalue>7140 and handvalue<7160
value$ = "Full House, 9s over "+card_value$(handvalue-7140)+"s"
endif
if handvalue>7160 and handvalue<7180
value$ = "Full House, 10s over "+card_value$(handvalue-7160)+"s"
endif
if handvalue>7180 and handvalue<7200
value$ = "Full House, Js over "+card_value$(handvalue-7180)+"s"
endif
if handvalue>7200 and handvalue<7220
value$ = "Full House, Qs over "+card_value$(handvalue-7200)+"s"
endif
if handvalue>7220 and handvalue<7240
value$ = "Full House, Ks over "+card_value$(handvalue-7220)+"s"
endif
if handvalue>7240 and handvalue<7260
value$ = "Full House, As over "+card_value$(handvalue-7240)+"s"
endif
exitfunction value$
endif
if handvalue>6000 and handvalue<7000
exit$="Flush, "+card_value$(handvalue-6000)+" high"
exitfunction exit$
endif
if handvalue>5000 and handvalue<6000
exit$="Straight, "+card_value$(handvalue-5000)+" high"
exitfunction exit$
endif
if handvalue>4000 and handvalue<5000
exit$="Trip "+card_value$(handvalue-4000)+"s"
exitfunction exit$
endif
if handvalue>3000 and handvalue<4000
if handvalue>3020 and handvalue<3040
value$ = "Two Pair, 3s and "+card_value$(handvalue-3020)+"s"
endif
if handvalue>3040 and handvalue<3060
value$ = "Two Pair, 4s and "+card_value$(handvalue-3040)+"s"
endif
if handvalue>3060 and handvalue<3080
value$ = "Two Pair, 5s and "+card_value$(handvalue-3060)+"s"
endif
if handvalue>3080 and handvalue<3100
value$ = "Two Pair, 6s and "+card_value$(handvalue-3080)+"s"
endif
if handvalue>3100 and handvalue<3120
value$ = "Two Pair, 7s and "+card_value$(handvalue-3100)+"s"
endif
if handvalue>3120 and handvalue<3140
value$ = "Two Pair, 8s and "+card_value$(handvalue-3120)+"s"
endif
if handvalue>3140 and handvalue<3160
value$ = "Two Pair, 9s and "+card_value$(handvalue-3140)+"s"
endif
if handvalue>3160 and handvalue<3180
value$ = "Two Pair, 10s and "+card_value$(handvalue-3160)+"s"
endif
if handvalue>3180 and handvalue<3200
value$ = "Two Pair, Js and "+card_value$(handvalue-3180)+"s"
endif
if handvalue>3200 and handvalue<3220
value$ = "Two Pair, Qs and "+card_value$(handvalue-3200)+"s"
endif
if handvalue>3220 and handvalue<3240
value$ = "Two Pair, Ks and "+card_value$(handvalue-3220)+"s"
endif
if handvalue>3240 and handvalue<3260
value$ = "Two Pair, As and "+card_value$(handvalue-3240)+"s"
endif
exitfunction value$
endif
if handvalue>2000 and handvalue<3000
for value=2 to 14
exit$="Pair of "+card_value$(handvalue-2000)+"s"
exitfunction exit$
next value
endif
if handvalue<2000
exit$="High Card "+card_value$(handvalue-1000)
exitfunction exit$
endif
endfunction ""
You'll still have to do some tweaking with the number positions on the cards.
Enjoy your day.