May 07, 2024, 12:07:00 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


computerised bingo

Started by hugh, August 08, 2008, 09:16:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hugh

August 08, 2008, 09:16:07 PM Last Edit: August 09, 2008, 06:38:04 AM by hugh
Well, firstly, i wish to say a very big thank for the help i have received from this foroum.
With the health problems recently, things have been a little below par, So not being to optomistic, and still a learner in MODERN programming.
I wish to upload ; "COMPUTERISED_BINGO"
It is freeware and you may do with it as you feel fit.
suggestions, would be highly appreciated though.
incidently, if you click, "Auto Caller On" you will not here the numbers 2,77,79.; but i will let you figure that out for yourself!!!.

Sorry, had to delete this unfinished uploaded code.

computerised bingo.zip now uploaded.
it is the source code only, as total size of computerised bingo with sounds etc is 105mb.

couldnt attache it.

regards

Hugh

LarryMc

August 08, 2008, 10:39:57 PM #1 Last Edit: August 08, 2008, 11:39:15 PM by Larry McCaughn
Hugh
I don't think all your program is there.

The last line is if f$="book" & ticket <= pa
Also a file that big would be better if it was zipped and attached to your posting.


Larry

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Hugh

I never did ask before but is playing Bingo with 90 numbers the norm over there?

I've never seen that before.

All I've ever seen is Bingo with 75 numbers - 5 colums of 15 numbers.

The bingo cards are 5 x 5.

Just curious.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Peter

Bingo with 90 numbers exist, but you're right that 75 is the "standard", Larry.

Had to ask my grandmas friend who is an addicted bingoplayer (all kinds) and knows everything about it. :)

hugh

javascript:void(0);

sorry, my error,

attempting to upload zip code.

so no sounds will be attached.

total size of computerised bingo with sounds etc is 105 mb.


and yes i have a version i downloaded from U.S.A., 75 numbers.

But 90 numbers is the norm in U.K.

Regards

Hugh

billhsln

Two thoughts, you might want to replace all the numbers and use Speech.  See:  http://www.ionicwind.com/forums/index.php/topic,2354.0.html
That way you do not need to have all the sound files attached.  As long as the right software is loaded on the PC, you can have your computer talk.

Would remove the need for the WAV files.

Also, I noticed that your code could be a little easier to write out if you would use the alternate version of IF.  I am not saying there is any thing wrong, just saying it would save you lots of time writing.  Note, I use AND rather than & mostly for style, both work, but & actually has a different purpose then AND.  I would use the & in a expression:  x = a & b (returns only the bits that are on in both a and b-not used very often).

Your Code:
if sn>en & bc > 0.01 then ENABLECONTROL w1, 122,0  else enablecontrol w1,122,1       'calculate flyer
if sn>en & bc > 0.01 then ENABLECONTROL w1, 123,0  else enablecontrol w1,123,1         'calculate books


Using alternate IF:
if sn>en and bc > 0.01 then
   ENABLECONTROL w1, 122,0
   ENABLECONTROL w1, 123,0
else
   enablecontrol w1,122,1
   enablecontrol w1,123,1
endif

Your code:
if f$="fun" & mycount = 90 then showwindow w1,@swhide,101
if f$="fun" & mycount = 90 then enablecontrol w1,119,1
if f$="fun" & mycount = 90 then enablecontrol w1,120,1
if f$="fun" & mycount = 90 then enablecontrol w1,122,1
if f$="fun" & mycount = 90 then enablecontrol w1,123,1
if f$="fun" & mycount = 90 then setcontroltext w1,114,str$(0.20)
if f$="fun" & mycount = 90 then setcontroltext w1,108,str$(0000)
if f$="fun" & mycount = 90 then setsize w1,sw/2-70,sh-220,140,130,101 :   ' reduce 101 to original size & position to see last number called
if f$="fun" & mycount = 90 then SETFONT w1, "Ariel", 80, 1000,@SFITALIC,101       
if f$ ="fun" & mycount = 90 then showwindow w1,@swrestore,101
if f$="fun" & mycount=90 then enablecontrol w1,121,0

Alternate IF:
if f$="fun" and mycount = 90 then
   showwindow w1,@swhide,101
   enablecontrol w1,119,1
   enablecontrol w1,120,1
   enablecontrol w1,122,1
   enablecontrol w1,123,1
   setcontroltext w1,114,str$(0.20)
   setcontroltext w1,108,str$(0000)
   setsize w1,sw/2-70,sh-220,140,130,101 :   ' reduce 101 to original size & position to see last number called
   SETFONT w1, "Ariel", 80, 1000,@SFITALIC,101
   showwindow w1,@swrestore,101
   enablecontrol w1,121,0
endif

Thanks for sharing an interesting program,
Bill
When all else fails, get a bigger hammer.

hugh

Thank you Bill,

I will most certainly use your alternate [IF].
as for the speech, i logged onto the link you gave me to Pauls source.
It wont compile on xp pro sp1. i think i know the reason.
so when the kids are finished with the laptop, (not mine), i will log on and get pauls speech source code.
It should run on vista and it will save a lot of space in my program.

once again, thank you.
regards.

Hugh

billhsln

I think I am running XP Pro, not sure about version, but am probably current with the latest.  The following code, compiles as a Console target and works fine on my machine:

IDispatch speech
string text
speech = CreateComObject("Sapi.SpVoice","")
if speech <> NULL
while ucase$(text) <> "END"
PRINT "Enter something to say, \"END\" to exit"
INPUT ">",text
CallObjectMethod(speech,".Speak(%s)",text)
endwhile
speech->release()
else
PRINT "Sapi object not available"
do:until inkey$ <> ""
endif

END


This should be the same example.

Bill
When all else fails, get a bigger hammer.

hugh

thank you bill.
I have just copied your code, and compiled it as a console target.
first time; I saved it as; text2speech, it compiled, but the linker  could not open it.
It saved to ebdv//projects/samples.
So i saved it again as ;ebasic1 to c:/computerised bingo.
it compiled perfectly  on the Laptop with Vista, I will try it on the other computer with XP later, the missus is blogging on it.
looks like i got a lot to write, or i just might setcontroltext with the things like,
Is every one ready, you are playing on your book of 5 pages, you are playing on the first page, eyes down  your first number for your single line is, rnum$,
and a lot more than that, nearly 2 hours recording of all the wav files, well what the heck, i will see how it goes anyway.
been busy changing alternate [IF] [THEN] [ELSE] [ENDIF], saves a lot of space and much neater.

thank you.

Hugh

hugh

Hello Bill.

I have taken your advice, and removed all the , "&" ;  replaced them with the proper one;  "AND"
I have also changed my program, were i found it needed it to your suggestion to the ;  alternative , "IF".
It makes the program more readable, and yes, a lot less typing.
I Have the idispatch speech up and running, just a few tweaks here and there to sort out, ie voice speed.
got voice to say, l$+"and"+r$+"thats number"+num1$;  ie;        [4]+ "and "+[7] +" thats number"+ 47

l$=left$(num1$,1)  :   r$=right$(num1$,1), and   num1$ is the random number to be called.

Just have to sort out the ; ON ITS ON NUMBERS, ie, 1 to 9.
I have inserted code in the sub bingonumber()

l=len(num1$)
if l<2 then r = 1
if l < 2 then r$=""
if l < 2 then
CallObjectMethod(speech,".Speak(%s)",l$+"on its own thats number"+num1$)
else CallObjectMethod(speech,".Speak(%s)",l$+"and"+r$+"thats number"+num1$
ENDIF

so i will have a look at it about 22:00 on sunday, thats today as its now, 03:40  sunday 10th august.
so i am going to bed now.

regards

Hugh

billhsln

I tried taking a hand at the number problem, to make it easier to work with.

Take a look at the following code and see if you can use it.

DEF i:INT
DEF n1_19[19],n20_90[8]:STRING
DEF num1$:STRING
DEF num1,num2:INT

RESTORE mydata1_19
RESTORE mydata20_90

FOR i = 0 to 18
GETDATA mydata1_19,n1_19[i]
NEXT i

FOR i = 0 to 7
GETDATA mydata20_90,n20_90[i]
NEXT i

' code.....

num1 = val(num1$)
if num1 < 19 then
CallObjectMethod(speech,".Speak(%s)",l$+"on its own thats number"+n1_19[num1-1])
else
num1 = val(mid$(num1$,1,1) - 2 : ' num1$ = 45, this returns num1 = 2, index 2 of n20_90 = "FORTY"
num2 = val(mid$(num1$,2,1) - 1 : ' num1$ = 45, this returns num2 = 4, index 4 of n1_19 = "FIVE"
CallObjectMethod(speech,".Speak(%s)",l$+"on its own thats number"+n20_90[num1]+n1_19[num2])
endif

DO:UNTIL INKEY$ <> ""
END

DATABEGIN mydata1_19
'      0     1      2       3      4     5      6       7      8      9
DATA "ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE","TEN"
'      10        11       12          13        14        15         16          17          18
DATA "ELEVEN","TWELVE","THIRTEEN","FOURTEEN","FIFTEEN","SIXTEEN","SEVENTEEN","EIGHTTEEN","NINETEEN"
DATAEND

DATABEGIN mydata20_90
'        0        1       2       3       4       5          6       7
DATA "TWENTY","THIRTY","FORTY","FIFTY","SIXTY","SEVENTY","EIGHTY","NINETY"
DATAEND


It may not be 100% exactly what you are looking for, but it might help, at least I hope so.

Bill
When all else fails, get a bigger hammer.

hugh

Hello Bill,
Thank you for your help.
sussed out an easier way for *.wav files.

i  am not all that keen on the computer voice, speaks the number 4 and 44 like, "for"  and  "forfour", to fast for my liking.
i had it saying  1 on its on thats number 1,     form 1 to 9
also had it saying, 11 all the ones thats number 11     from to 11  to  88  step 11
also had it saying, 90 ninezero 90        from 10 to 90 step 10

yes i could make a data block with all the speech, from 1 to 90 as a string, and use rnum  as the pointer to the data to be spoken, but i dont really think its warranted.
I have already used your alternate IF , ENDIF, and changed every ; & ; to ; AND.
so thanks again.

Regards

Hugh


hugh

I have removed the original uploaded computerised bingo.
this version uses the Sapi voice call.
but i have been having problems with it,  ie; it cuts short the number [4] ; and at times it ; or should i say ;"She" ; does not always say the number [8] properly.
The following code is from the Sub bingonumber().

if computer$="yes" THEN
string say$
IDispatch speech
speech = createComObject("Sapi.SPVoice","")
if speech = null then messagebox(w1,"Sorry , Your Computer Does Not Have [VOICE] installed"+chr$(13)+"Search for an update for your system","ERROR!")
if speech = null then computer$=""
if computer$="yes" THEN
l=len(num1$)
     l$=left$(num1$,1):r$=right$(num1$,1)
c=val(l$):r=val(r$)
'say$ is required for this game to simulate a bingo caller, i have not included any slang like that of [69] "any way up",etc
'i am just trying to get it to say that which is called in Bingo halls, Not that which is called in [some] Local drinking clubs
if c = r and c = 1 then say$ = "ones"
if c = r and c = 2 then say$ = "toos"
if c = r and c = 3 then say$ = "threes"
if c = r and c = 4 then say$ = "fours"
if c = r and c = 5 then say$ = "fives"
if c = r and c = 6 then say$ = "sixes"
if c = r and c = 7 then say$ = "sevens"
if c = r and c = 8 then say$ = "eights"
'the next four lines are for Sapi, speak the number and all that is inserted between quotes
'*******************************************************************************************the null quotes are a test for speech delay
if l > 1 AND c <> r AND r > 0 then callOBjectMethod(speech,".SPeak(%s)",str$(rnum)+"  "+"its"+str$(c)+"  "+"AND"+"  "+str$(r)+"thats number"+" "+str$(rnum))
if l > 1 AND c = r THEN callOBjectMethod(speech,".SPeak(%s)",str$(rnum)+" "+"ITS all the"+" "+say$+"  "+" "+"thats number"+" "+str$(rnum))
if l > 1 AND r  < 1 THEN callOBjectMethod(speech,".SPeak(%s)",str$(rnum)+"  "+"its"+" "+str$(c)+" "+"zero"+" "+"thats number"+" "+str$(rnum))
if l < 2 THEN callOBjectMethod(speech,".SPeak(%s)",str$(rnum)+" "+"ITS on its own"+" "+" "+"thats number"+" "+str$(rnum))
'********************************************************************************************ie,str$(rnum)+" "+say$+" "+" "+c
speech->release():          'return from calling Sapi
ENDIF



as you can see ; i have used +" ",  this was done to attempt to get a delay in the speech.
i am sure i have seen a speed setting from 0 to 10 in one of Pauls replies to someone?.
i just dont know were to put it.
So; the button;  [Computer Speaks], top left of screen, Red on Black background turns the [Sapi] on.
clicking on the [Author] button; turns [Sapi] off, but it also turns my voice on, fortunatley for you, it is not included.
the wave files are to large to upload; even when compressed.
So ; can anyone show me were in the Sapi ; i can put the (Speech Speed delay].
I would appreciate it.

The program is freeware without my voice, with my voice it is ÂÃ,£4.99, that equate to $10.00,+ $5.00 mail charges on CD, ha ha. now wouldnt that be a joke!
I am working on the 75 number U.S.A.;  version, i cant see that being a problem though.
When i have it sussed then i will upload it.

You will see some changes in this [source] compared to that which was uploaded before, Bills suggestions have been implemented.

Regards.

Hugh

billhsln

To change the speech rate do:

SetComProperty(speech,".Rate = %d",x)  : ' where x is between -10 and 10

put this after the speech = createComObject("Sapi.SPVoice","") has been validated to be available.  Line after 'if computer$="yes" THEN'.

Another command to take a look at:

Your code:
if c = r and c = 1 then say$ = "ones"
if c = r and c = 2 then say$ = "toos"
if c = r and c = 3 then say$ = "threes"
if c = r and c = 4 then say$ = "fours"
if c = r and c = 5 then say$ = "fives"
if c = r and c = 6 then say$ = "sixes"
if c = r and c = 7 then say$ = "sevens"
if c = r and c = 8 then say$ = "eights"

Revised:
if c = r then
    SELECT c
    CASE 1
            say$ = "ones"
        CASE 2
            say$ = "toos"
        CASE 3
            say$ = "threes"
        CASE 4
            say$ = "fours"
        CASE 5
            say$ = "fives"
        CASE 6
            say$ = "sixes"
        CASE 7
            say$ = "sevens"
        CASE 8
            say$ = "eights"
        DEFAULT
            say$ = "missing"
    ENDSELECT
endif

SELECT is a very powerful and useful command.

Hope it helps.

Bill
When all else fails, get a bigger hammer.

hugh

Thank you bill, pretty neat that SELECT, now for the truth.
I thought that SELECT was only used in the &,handler, & main, ie the main sub which windows.
Silly me.
neat piece of reconstruction of my code, i am going to change mine to yours.
as for the SetComPropert(speech,",Rate = 0%d",x) : 'wher x is between -10 and 10.
i used 0.5!, But  now i can slow the voice down. thanks for that Bill.
as you can see from the revised version, i took your advice.
logged off earlier to write code for 75 number U.S.A. bingo, Im was just sussing out the step to as mine is 10 for the 90 numbers.
used 15, but will look at it again, probably about noon as its 03:15am now, Insomnia?.

Regards.

Hugh

billhsln

Glad you are able to use the code.  Waiting patiently for your revised code.  So far I have not actually run your program to see what it looks like.  So, when you get your next version ready, will definitely load and compile to see how it works and what it looks like.

When you get a chance, take a look at the Casino Poker game I wrote:  http://www.ionicwind.com/forums/index.php/topic,2349.0.html

I wrote it for my Dad, who likes to play a machine that is some what like the one I wrote.  Except it does not tell you how much you lost on each batch of hands.

Take care,
Bill
When all else fails, get a bigger hammer.

hugh

Hello Bill,

I just clicked on the Link you gave and downloaded your Poker game.
I will run it later, I used to be a big card gambler many moons ago, 5  card straight, 5 card draw, 7 card draw.
I just do the Lotto once a week for ÂÃ,£1.00 ($2.00).i
well dont expect any bingo balls to be floating around the screen!, Its just that which is seen in bingo halls in this country,  except the board is not as long as bingo halls.
But instead of highliighting the called numbern;  It is circled in red.
Basicly it is a simple board grid of ninety numbers within a rectangle, 10 numbers in each row, and  8 rows; ie [10,8].     ie,  1    2    3    4    5    6    7    8   9    10
It does the job i intended it to do, Give the user the choice of, voices and on/off voice.
user chooses which game to play, books or single flyer ticket, also the charity raising program, Fun Bingo.
program calculates what to pay out based on users input, ie,total books started with, books remaining after books sold, cost per book, pre set to 0.20 single book/ticket.
if playing on books then insert number of pages in the book, minimum = 3 maximum = 9, this is needed to calculate linepay/page# and housepay/page#
user also has the choice of bypassing all calculations to use the game as a bingo machine and he/she calls the numbers and calculates the payouts.
message appears explaining what to do via static button, using setcontroltext for each message to the same button.
simple sample            setcontroltext w1,750" click here  if  [liNE NOT CORRECT] ,   If correct the click Large Yellow, [----->[START] button to continue
when in calculate mode the user can save the data to a simple text file by pressing the [Save] button.



well thats it basicly.

Regards

Hugh