OFF-topic. Just programming but not computer chess progr.
-
- Posts: 1
- Joined: Sat Dec 18, 2010 11:52 am
- Real Name: Dimitris Pesketzis
OFF-topic. Just programming but not computer chess progr.
Many thanks in advance.
Note to the admin: this whole post is a combination of pictures and not text since when i tried to post the text shown here it said(in preview i had no problem):
General Error
SQL ERROR [ mysqli ]
Incorrect string value: '\xE2\x99\xA0, 2...' for column 'post_text' at row 1 [1366]
An SQL error occurred while fetching this page. Please contact the Board Administrator if this problem persists.
For trying to see why, i have saved the text and if you like you can copy it here: http://textsave.de/?p=43639
-
- Posts: 1242
- Joined: Thu Jun 10, 2010 2:13 am
- Real Name: Bob Hyatt (Robert M. Hyatt)
- Location: University of Alabama at Birmingham
- Contact:
Re: OFF-topic. Just programming but not computer chess progr
Several ideas:
(1) A - K of hearts => 1-13, A - K of diamonds = 101-113, A-K of clubs = 201-213, and A-K of spades = 301-313.
(2) A - K of hearts = 1-13. A - K of diamonds = 14-26, etc.
There are lots of ways to represent the cards. Using #1 above, you can obtain the "sequence number" (A=1, 2-2, ..., K=13) by using "sequence = card % 100. That will return a value of 1-13 for any card type. For suit, "suit = card / 100" which will return a value of 0, 1, 2 or 3 for the four suits of the cards. For color (since you have to alternate colors for part of the game) "color = card / 200, which will return 0 for hearts/diamonds and 1 for clubs/spades.
The only issue is to choose the encoding such that you can obtain the sequence #, the suit, and the color, as easily as possible.
(1) A - K of hearts => 1-13, A - K of diamonds = 101-113, A-K of clubs = 201-213, and A-K of spades = 301-313.
(2) A - K of hearts = 1-13. A - K of diamonds = 14-26, etc.
There are lots of ways to represent the cards. Using #1 above, you can obtain the "sequence number" (A=1, 2-2, ..., K=13) by using "sequence = card % 100. That will return a value of 1-13 for any card type. For suit, "suit = card / 100" which will return a value of 0, 1, 2 or 3 for the four suits of the cards. For color (since you have to alternate colors for part of the game) "color = card / 200, which will return 0 for hearts/diamonds and 1 for clubs/spades.
The only issue is to choose the encoding such that you can obtain the sequence #, the suit, and the color, as easily as possible.
Re: OFF-topic. Just programming but not computer chess progr
Use an array of structsSolitaireman wrote:Please no tricks but only a general way
If you think it is "small and qucik" it means you even didn't start yet (nor I think you will do in the future).Solitaireman wrote:In fact i would be very thankful if anyone could solve the whole (small and quick) problem for me