Hi there!
Are you a betting person?
Here then is a completely revamped version of Acey Ducey, an exciting card game, in which you are dealt two cards and are invited to place
or not to place a bet depending on whether or not you think the next card dealt will fall between your two cards.
You nominate your starting bank [minimum of 100 dollars] and it fluctuates according to the result of your bet.
Should you decide not to bet and a win is possible, you will lose 10 dollars.
The game lasts (a) a maximum of 17 hands x 3 cards, (b) until you lose all your money, (c) until you terminate the game via Esc or F12 key, whichever comes first.
The attached zip file contains the necessary media required to run the game.
Enjoy.
gearce
(GRC)
remstart
=======================================================
ACEY DUCEY CARD GAME
***********************
Author: gearce - June 2007
Revised - January 2008
***********************
=======================================================
remend
rem Call procedures to set everything up and display Intro Screen
gosub setup
gosub intro
rem Main programme loop
do
gosub play
gosub playagain
loop
rem End programme
end
rem ****************************************************************
rem Set up
rem ****************************************************************
setup:
rem Create, load and paste a bitmap containing images of 52 cards
Create Bitmap 1,1024,768
Load Image "Cards.png",1000
Paste Image 1000,0,0
rem Extract individual images from bitmap
CardNum=1
For Ny=0 To 3
For Nx=0 To 12
Get Image CardNum,Nx*73+1,Ny*98+1,Nx*73+1+72,Ny*98+1+97
Inc CardNum
Next Nx
Next Ny
rem Delete image containing images of 52 cards
Delete Image 1000
rem Set working bitmap
Set Current Bitmap 0
rem Delete non-working bitmap
Delete Bitmap 1
rem Assure each call to the RND produces a different order of random numbers
randomize timer()
rem This command will hide mouse pointer
hide mouse
rem Determine centre of screen width
sc=screen width()/2
rem Declare array/s
dim card(52):dim number(52):dim number$(52):dim intro$(22)
rem Load images to block out previous images and text at the location
load image "blockout.bmp",101
load image "box.bmp",201
load image "box3.bmp",401
return
rem ****************************************************************
rem Introduction
rem ****************************************************************
intro:
rem Call function to change text style and size and ink colour
set_text("arial",36,"b",255,217,128)
th= text height("X")
rem Define the message string ...
message$="ACEY DUCEY CARD GAME"
tw=text width(message$)
rem Set across and down coordinates and part counter
across=sc-(tw/2):down=240-(th/2):part=0
rem ... and write to screen in four parts
repeat
rem Increment part number
inc part
select part
case 1 : pos=1:length=5 : endcase
case 2 : pos=6:length=11 : across=across+text width(sub$) : endcase
case 3 : pos=12:length=16 : across=across+text width(sub$) : endcase
case 4 : pos=17:length=20 : across=across+text width(sub$) : endcase
endselect
sub$=""
for n=pos to length
sub$=sub$+mid$(message$,n)
next n
rem A short wait before proceeding
wait 500
rem Write text here
text across,down,sub$
until part=4
rem A short wait before proceeding
wait 500
rem Clear screen
cls
rem Call function to change text style and size and ink colour
set_text("arial",19,"b",255,217,128)
th= text height("X")
rem Turn on screen refreshing
sync on
rem Define the introduction strings.
intro$(1)="Acey Ducey is played in the following manner."
intro$(2)=""
intro$(3)="Cards are valued 2 - Ace(14)."
intro$(4)=""
intro$(5)="You are dealt two cards face up. You have an option to bet"
intro$(6)="or not to bet depending on whether or not you feel the next"
intro$(7)="card dealt will have a value between the first two."
intro$(8)=""
intro$(9)="If your option is not to bet, input a 0. Note, however, should"
intro$(10)="you opt not to bet, and a win is possible, you will lose 10"
intro$(11)="dollars."
intro$(12)=""
intro$(13)="Your initial bank is set to the amount you nominate - minimum"
intro$(14)="100 dollars."
intro$(15)=""
intro$(16)="The game lasts:"
intro$(17)="A maximum of 17 hands x 3 cards or"
intro$(18)="Until you lose all your money or"
intro$(19)="Until you terminate the game via Esc or F12 key."
intro$(20)="whichever comes first."
intro$(21)=""
intro$(22)="Press any key to begin."
rem Determine text width of longest introduction string
tw=text width("Your initial bank is set to the amount you nominate - minimum")
rem Write introduction strings to screen
for n=1 to 22
rem Set across coordinate
across=sc-tw/2
text across,n*19+19,intro$(n)
next n
rem Let programme handle screen refreshing
sync
rem Return screen refreshing to system
sync off
rem Suspend for keypress
wait key
rem Clear screen
cls
return
rem ****************************************************************
rem Play
rem ****************************************************************
play:
rem Go to subroutine to get random numbers
gosub randomnumbers
rem Call function to change text style and size and ink colour
set_text("arial",36,"b",255,217,128)
th= text height("X")
rem Write title text to screen
center text sc,10,"ACEY DUCEY CARD GAME"
rem Call function to change text style and size and ink colour
set_text("arial",21,"b",255,217,128)
th= text height("X")
rem Until initial bank is nominated
repeat
rem Turn on screen refreshing
sync on
rem Write text
text 107,79,"Nominate your initial bank (minimum 100)"
rem Paste box image
paste image 201,481,79
rem Let programme handle screen refreshing
sync
rem Return screen refreshing to system
sync off
rem Set cursor
set cursor 468,82
rem Input bank
input " ";initial
until initial>=100
rem Progressive bank
progressive=initial
rem Go to subroutine to determine progressive bank
gosub bank
rem Set cards dealt counter
cardsdealt=0
rem Continue until 51 cards are dealt - 17 hands each of 3 cards
repeat
rem Set across and down coordinates
across=sc-74:down=153
rem Increment cards dealt counter
inc cardsdealt
if cardsdealt=1
center text sc,121,"Here are your first two cards"
rem A short wait before proceeding
wait 1000
endif
for deal=4 to 49 step 3
set text opaque
if cardsdealt=deal
center text sc,121,"Here are your next two cards"
rem A short wait before proceeding
wait 1000
endif
next deal
rem Set a win counter
awin=0
rem Where to paste first of three card image
paste image card(cardsdealt),across,down
rem Go to subroutine to check card value
gosub checkvalue
rem First card value. This is used in the equation to determine
rem whether the value of the third card is between that of the
rem first and second cards
value1=value
rem Increment across coordinate
inc across,73
rem Increment cardsdealt counter
inc cardsdealt
rem Where to paste second of three card image
paste image card(cardsdealt),across,down
rem Go to subroutine to check card value
gosub checkvalue
rem Second card value. This is used in the equation to determine
rem whether the value of the third card is between that of the
rem first and second cards
value2=value
rem A short wait before proceeding
wait 1000
rem Go to subroutine to get bet after every second card dealt
for gobet=2 to 50 step 3
if cardsdealt=gobet
gosub whatsyourbet
endif
next gobet
rem A short wait before proceeding
wait 1000
rem If bank balance equals no dollars
if progressive=0 then return
until cardsdealt=51
return
rem ****************************************************************
rem Play again
rem ****************************************************************
playagain:
rem Clear previous text from location
paste image 401,1,407
rem Turn on screen refreshing
sync on
rem Write text
if progressive=0
text$="Sorry! You have no dollars left. Play again?"
else
text$="Game over. Play again?"
endif
center text sc,407,text$
rem Clear previous text from location
paste image 401,1,449
rem Write text
text$="Left click mouse for YES - right click mouse for NO"
center text sc,449,text$
rem Let programme handle screen refreshing
sync
rem Return screen refreshing to system
sync off
rem Until mouse is clicked
repeat
mc=mouseclick()
until mc>0
rem Clear screen
cls
rem User chose right button to end...
if mc=2
center text sc,240,"Thanks For Playing ... Bye!"
wait 3000
cls: end
endif
rem If we are here then user must want to play again, so wait for release
rem of left mouse button...
repeat
until mouseclick()=0
rem Gosub Intro: rem <<< Enable this line if you want introduction shown at
rem start of every game
rem As the programme is now modular, the Return below drops back into the
rem main programme Do..Loop and continues round again calling all the procedures
rem in turn to play the game.
return
rem ****************************************************************
rem Subroutine to determine value of cards dealt
rem ****************************************************************
checkvalue:
for a=1 to 40 step 13
if card(cardsdealt)=a then value=2
next a
for a=2 to 41 step 13
if card(cardsdealt)=a then value=3
next a
for a=3 to 42 step 13
if card(cardsdealt)=a then value=4
next a
for a=4 to 43 step 13
if card(cardsdealt)=a then value=5
next a
for a=5 to 44 step 13
if card(cardsdealt)=a then value=6
next a
for a=6 to 45 step 13
if card(cardsdealt)=a then value=7
next a
for a=7 to 46 step 13
if card(cardsdealt)=a then value=8
next a
for a=8 to 47 step 13
if card(cardsdealt)=a then value=9
next a
for a=9 to 48 step 13
if card(cardsdealt)=a then value=10
next a
for a=10 to 49 step 13
if card(cardsdealt)=a then value=11
next a
for a=11 to 50 step 13
if card(cardsdealt)=a then value=12
next a
for a=12 to 51 step 13
if card(cardsdealt)=a then value=13
next a
for a=13 to 52 step 13
if card(cardsdealt)=a then value=14
next a
return
rem ****************************************************************
rem Subroutine to get bet
rem ****************************************************************
whatsyourbet:
repeat
rem Turn on screen refreshing
sync on
rem Write text
center text 290,259,"What's your bet? "
rem Paste box image
paste image 201,371,259
rem Let programme handle screen refreshing
sync
rem Return screen refreshing to system
sync off
rem Set cursor
set cursor 358,262
rem Input bet
input " ";bet
if bet>progressive
rem Write text
text$="Sorry! You bet too much. Your bank is only "+str$(progressive)+" dollars"
center text sc,407,text$
rem A short pause before proceeding
wait 1500
rem Paste box 3 image
paste image 401,1,407
endif
until bet>=0 and bet<=progressive
rem Set across and down coordinates
across=sc-37:down=290
rem Increment cards dealt counter
inc cardsdealt
rem Where to paste third of three card image
paste image card(cardsdealt),across,down
rem Go to subroutine to check card value
gosub checkvalue
rem Third card value. This is used in the equation to determine
rem whether the value of the third card is between that of the
rem first and second cards
value3=value
rem Check if third card has a value between previous two cards
gosub checkbetween
rem Paste image to block out all previous text and images
paste image 101,1,121
rem A short wait before proceeding
wait 1000
return
rem ****************************************************************
rem Subroutine to determine if third card value is between first and
rem second card values
rem ****************************************************************
checkbetween:
if (value3>value1 and value3<value2) or (value3<value1 and value3>value2)
rem Set a win counter to 1
awin=1
endif
if awin=1 and bet=0
center text sc,407,"Sorry! a win was possible - you lose 10 dollars"
rem Subtract from progressive bank
progressive=progressive-10
center text sc,450,"Press any key to continue"
rem Suspend for keypress
wait key
rem Paste image to block out all previous text and images
paste image 101,1,121
gosub bank
endif
if awin=1 and bet>0
center text sc,407,"Congratulations, you win"
rem Add to progressive bank
progressive=progressive+bet
center text sc,450,"Press any key to continue"
rem Suspend for keypress
wait key
rem Paste image to block out all previous text and images
paste image 101,1,121
gosub bank
endif
if (value3<value1 and value3<value2) or (value3>value1 and value3>value2)
if bet>0
center text sc,407,"Sorry! you lose"
rem Subtract from progressive bank
progressive=progressive-bet
center text sc,450,"Press any key to continue"
rem Suspend for keypress
wait key
endif
if bet=0
center text sc,407,"No bet"
center text sc,450,"Press any key to continue"
rem Suspend for keypress
wait key
endif
rem Paste image to block out all previous text and images
paste image 101,1,121
gosub bank
endif
if (value3=value1) or (value3=value2)
if bet>0
center text sc,407,"Sorry! you lose"
rem Subtract from progressive bank
progressive=progressive-bet
center text sc,450,"Press any key to continue"
rem Suspend for keypress
wait key
endif
if bet=0
center text sc,407,"No bet"
center text sc,450,"Press any key to continue"
rem Suspend for keypress
wait key
endif
rem Paste image to block out all previous text and images
paste image 101,1,121
gosub bank
endif
return
rem ****************************************************************
rem Subroutine to determine progressive bank
rem ****************************************************************
bank:
rem Clear previous text from location
paste image 401,1,79
rem Write text
center text sc,79,"Your bank is now "+str$(progressive)+" dollars"
rem If progressive bank equals zero
if progressive=0
rem Clear previous text from location
paste image 401,1,407
endif
return
rem ****************************************************************
rem Subroutine to divide 52 numbers into 4 groups of 13 and arrange
rem in random order
rem ****************************************************************
randomnumbers:
` Divide 52 numbers into 4 groups of 13
Firstthirteen$ ="01020304050607080910111213"
Secondthirteen$="14151617181920212223242526"
Thirdthirteen$ ="27282930313233343536373839"
Fourththirteen$="40414243444546474849505152"
numbers$=Firstthirteen$+Secondthirteen$+Thirdthirteen$+Fourththirteen$
rem Arrange numbers in random order
for n=1 to 52
nextnumber=rnd(len(numbers$)/2-1)
number$(n)=mid$(numbers$,nextnumber*2+1)+mid$(numbers$,nextnumber*2+2)
numbers$=left$(numbers$,nextnumber*2)+right$(numbers$,len(numbers$)-nextnumber*2+2)
number(n)=val(number$(n))
card(n)=number(n)
next n
return
rem ****************************************************************
rem Function to change text style and size and ink colour
rem ****************************************************************
function set_text(font$,sz,style$,r,g,b)
set text font font$,1
set text size sz
if style$="b" then set text to bold
if style$="n" then set text to normal
ink rgb(r,g,b),0
sync
endfunction th
LANG MEY YER LUM REEK
I’m getting outta this one horse town - Just as soon as it’s my turn to ride the horse.