Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Solitaire Logic

Author
Message
Sickly
15
Years of Service
User Offline
Joined: 14th Jul 2009
Location: Does it matter?
Posted: 22nd Apr 2011 23:28
Hi. I am in the pen and paper part of writing a solitaire game. Still new to DBPro. I have most of the program down on paper, but I am having a hard time with the logic behind a part of the game. The part I am stuck on is telling the computer if the card is red, then a black colored card is next.
An example would be like this. I have a six of hearts that I want to drop the 5 of spades on. Can anyone maybe give me some hints or tips on what type of logic I would use for this? How would I determine that black is after red in a nut shell. Sorry if this is confusing, and thanks.

The darkest minds, are often the brightest.
No Time To Code
15
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 23rd Apr 2011 00:13
I would use a array and UDT (User Defined Types) to assign values to the cards.



You can load the values from loops



Then to see if a card can be placed on top of another you can do something like this:

Say the card that is down is number 3 (in this example it's the 3 of hearts) and the player wants to place card number 2 (the 2 of hearts) you can check:



There are lots of other ways to do it but this is one.

It is not from the benevolence of the butcher, the brewer, or the baker, that we expect our dinner, but from their regard to their own interest. --Adam Smith
Sickly
15
Years of Service
User Offline
Joined: 14th Jul 2009
Location: Does it matter?
Posted: 23rd Apr 2011 04:24
Thank you.

The darkest minds, are often the brightest.

Login to post a reply

Server time is: 2024-11-22 23:20:04
Your offset time is: 2024-11-22 23:20:04