Liberty BASIC Community Forum
« Card Game Contest! »

Welcome Guest. Please Login or Register.
Oct 23rd, 2017, 5:30pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1 2 3 4  ...  6 Notify Send Topic Print
 veryhotthread  Author  Topic: Card Game Contest!  (Read 7631 times)
Admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 14485
smiley Re: Card Game Contest!
« Reply #15 on: Aug 1st, 2011, 11:57am »

Jaba, I can select cards again and again, so I cannot replicate the behavior.

Unfortunately, the "stack of cards" behavior WAS intended. It happens when you close the window. It's meant to be a cute visual effect -- all cards moving to the first position,one-at-at-time, face-up just before the window closes. It is not a second window; just the program window attempting to be clever. (And clearly missing the mark!)
« Last Edit: Aug 1st, 2011, 11:58am by Admin » User IP Logged

Admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 14485
smiley Re: Card Game Contest!
« Reply #16 on: Aug 1st, 2011, 12:01pm »

Hold the phone... I CAN replicate the behavior where cards cannot be reselected. Hmm. That was not a problem as I developed the game, so I must have introduced that bug feature near the end. Thanks for the report. I'll try to fix it.
« Last Edit: Aug 1st, 2011, 12:02pm by Admin » User IP Logged

Admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 14485
smiley Re: Card Game Contest!
« Reply #17 on: Aug 1st, 2011, 12:29pm »

The problem with re-selection has been fixed. I'd set card status to disabled and somehow lost the code to reset that if the cards didn't match.

The "clever" animation at the end still exists, but you can remove that from your copy of the code if you'd like. wink

Thanks.
User IP Logged

jaba
Senior Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 325
smiley Re: Card Game Contest!
« Reply #18 on: Aug 1st, 2011, 5:10pm »

on Aug 1st, 2011, 12:29pm, Alyce Watson wrote:
The problem with re-selection has been fixed. I'd set card status to disabled and somehow lost the code to reset that if the cards didn't match.

The "clever" animation at the end still exists, but you can remove that from your copy of the code if you'd like. wink

Thanks.

Ahhh. Works great. And, I like the animation at the ending. Incidentally, I commented out the playwave commands for my play; it just is too slow on my machine. I'm going to enjoy spending some time with the game - and the code!

jaba
User IP Logged

If I didn't first try it and get it wrong, I may never have figured out how to get it right.
jaba
Senior Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 325
smiley Re: Card Game Contest!
« Reply #19 on: Aug 1st, 2011, 11:33pm »

Alyce,

I ran my first complete game this evening. Everything worked well. The game is very smooth. Incidentally, I scored a 23 on my first game. Don't think I'll be able to do that again!

jaba
User IP Logged

If I didn't first try it and get it wrong, I may never have figured out how to get it right.
Admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 14485
smiley Re: Card Game Contest!
« Reply #20 on: Aug 4th, 2011, 08:10am »

Thanks, Jaba. I'd love to see you enter this contest, too!

I thought this idea would spark more interest. The DLLs are easy to use; especially the Windows cards32.dll. The tutorials and examples on LBPE were either updated or written for this contest.

I hope some more members will stretch their wings and give this a try. Games are fun!
User IP Logged

jaba
Senior Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 325
smiley Re: Card Game Contest!
« Reply #21 on: Aug 4th, 2011, 4:25pm »

Quote:
Thanks, Jaba. I'd love to see you enter this contest, too!


I'm working on "Go Fish!", which was my favorite game as a kid.

But, there's a reason I have not tried to make a card game before - I don't know what the heck I'm doing!!!

I'm taking it on one step at a time and maybe there will be something to post before the end of the month - even if incomplete.

Having fun, though.

jaba
User IP Logged

If I didn't first try it and get it wrong, I may never have figured out how to get it right.
Janet
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 4111
xx Re: Card Game Contest!
« Reply #22 on: Aug 4th, 2011, 5:25pm »

on Aug 4th, 2011, 4:25pm, jaba wrote:
I'm working on "Go Fish!", which was my favorite game as a kid.

But, there's a reason I have not tried to make a card game before - I don't know what the heck I'm doing!!!

I'm taking it on one step at a time and maybe there will be something to post before the end of the month - even if incomplete.

Having fun, though.

jaba

I'm not sure mine will be totally finished, either, Jaba, but I do intend to post what I have. I hope you'll do the same. A 'Go Fish' game will be fun. grin
User IP Logged

Windows 7 Professional, SP1, 64 bit Intel Core i5-4200U CPU @ 1.60 GHz 2.30 GHz 6.00 GB

"I am very busy finding out what people mean by what they say." -
jaba
Senior Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 325
smiley Re: Card Game Contest!
« Reply #23 on: Aug 5th, 2011, 12:21pm »

Re: Opening QCARD32.HLP.

I have not been able to open this help file which came in the qcard32.zip package. I get this message:
"Cannot display this help file. Try opening the help file again, and if you still get this message, copy the help file to a different drive, and try again."

I've tried everything I know to do with no luck. So, I thought I'd ask here and see if anyone has an idea.

I'm using Vista and I have the ms help file program installed (whatever the name is). I can open other help files with the .hlp extension.

Thanks,
jaba
User IP Logged

If I didn't first try it and get it wrong, I may never have figured out how to get it right.
Admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 14485
smiley Re: Card Game Contest!
« Reply #24 on: Aug 5th, 2011, 1:24pm »

My series of tutorials documents almost all of the functions.

It doesn't address block dragging.

Is there something particular that you need? Perhaps I can copy all of the topics from the helpfile to a page at LBPE.
User IP Logged

Admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 14485
smiley Re: Card Game Contest!
« Reply #25 on: Aug 5th, 2011, 1:49pm »

Here is the documentation:
http://lbpe.wikispaces.com/QCardDocumentation

If there is something other than block dragging that isn't addressed in my tutorials, let me know so I can correct it.

(I really did try to hit everything. smiley )
User IP Logged

Stefan Pendl
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Computers are like babies, you must teach them what you like them to do ...


Homepage PM

Gender: Male
Posts: 5297
xx Re: Card Game Contest!
« Reply #26 on: Aug 5th, 2011, 4:19pm »

on Aug 5th, 2011, 12:21pm, jaba wrote:
Re: Opening QCARD32.HLP.

I have not been able to open this help file which came in the qcard32.zip package. I get this message:
"Cannot display this help file. Try opening the help file again, and if you still get this message, copy the help file to a different drive, and try again."


Might be a 16-bit help file, which is not supported by Vista and above, only 32-bit HLP files are supported.
User IP Logged

Stefan

Make sure to read and follow the Forum Guidelines

Liberty BASIC Pro 4.04, Windows 10 Professional x64, Intel Core i7-4710MQ 2.5GHz, 16GB RAM
jaba
Senior Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 325
smiley Re: Card Game Contest!
« Reply #27 on: Aug 5th, 2011, 7:06pm »

Re: Opening QCARD32.HLP.

Alyce. I'm following your tutorials (which are very easy to follow) and I don't have any questions yet. Thanks for posting the help file. Having it all in one place is 'help'ful and I won't be wondering if I'm missing something.

Stefan. I hadn't thought about the file being an older version, but I'm sure you're right about that. Thanks.

jaba
User IP Logged

If I didn't first try it and get it wrong, I may never have figured out how to get it right.
jaba
Senior Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 325
smiley Re: Card Game Contest!
« Reply #28 on: Aug 6th, 2011, 4:17pm »

Re: Sorting cards

Working on Go Fish! card game. I'm banging my head against the wall trying to figure out how to sort 7 cards by VALUE ONLY, not suit>value as the dll has numbered the cards.

Example: Normal sort of 7 random cards:
2C, 9C, 7D, 9D, QD, 2H, QH
I need this:
2, 2, 7, 9, 9, Q, Q with no particular suit order.

Here's some of the code I have so far:
Code:
[fillCardArray]
    for i = 1 to 52
        card(i)=i 
    next
[shuffleCards]
     for i = 1 to 52
        newIndex=int(rnd(0)*52)+1
        tempCard=card(i)
        card(i)=card(newIndex)  ':print card(i)
        card(newIndex)=tempCard
    next
[P1]
    'by default, cards are face up
    'deal computer hand face down
    'first 7 cards of shuffled deck go to player 1
    for i = 1 to 7
        P1(i)=card(i)
    next i
'>>>>Here's the problem...
    'sort deal - these cards are in order of suit + value
    'this does not solve problem of sorting by value only
    sort P1(), 1, 7
for i = 1 to 7
    print P1(i)        'print routine to check sort order
next
wait

'then I draw the 7 cards with this code:
    'draw the sorted cards on the table
    for i = 1 to 7
        scan
        'set face down=0
        call SetCardStatus P1(i), 1   '<---change to 0 when ready
        'window handle, card index number, x, y
        call DrawCard hBox, P1(i),i*48,10
        call Pause 100
    next
wait
 

I hate to have to ask for help so early in the development, but I'm just at a standstill on this. Any ideas?

jaba
User IP Logged

If I didn't first try it and get it wrong, I may never have figured out how to get it right.
Janet
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 4111
smiley Re: Card Game Contest!
« Reply #29 on: Aug 6th, 2011, 6:37pm »

Instead of putting the cards in a numerical array, put them in a string array. That way you can place several pieces of information in each array slot. Something like

psuedocode -
look at card(i)
what is the suit? (1-4)
what is the value? (1-13)
use select case to assign S, H, C, D depending on suit value (I'm pretty sure I don't have S, H, C, D in correct order)
use right$("0";value, 2) to assign 1-9 to "01" - "09", 10-13 to "10" - "13"
P1$(i) = str$(card(i));"-";suit$;"-";faceValue$

now, whenever you want to sort, just use word$ to rearrange. If you want to sort by faceValue then put the 3rd piece first.

for i = 1 to numberOfCardsToSort
P1$(i) = word$(P1$(i), 3, "-");"-";word$(P1$(i), 1, "-");"-";word$(P1$(i), 2, "-")
next i

Now sort

sort P1$(), 1, numberOfCardsToSort

Put the pieces back in original order
for i =1 to numberOfCardsToSort
P1$(i) = word$(P1$(i), 2, "-");"-";word$(P1$(i), 3, "-");"-";word$(P1$(i), 1, "-")
next i

Just make sure to always restructure the P1$() elements to cardNumber, suit, faceValue after every sort routine.

I'm sure there are dozens of ways to do this, but this is how I'd do it.

Looking forward to seeing your entry. grin
« Last Edit: Aug 6th, 2011, 6:39pm by Janet » User IP Logged

Windows 7 Professional, SP1, 64 bit Intel Core i5-4200U CPU @ 1.60 GHz 2.30 GHz 6.00 GB

"I am very busy finding out what people mean by what they say." -
Pages: 1 2 3 4  ...  6 Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls