Page 1 of 1

OFF-topic. Just programming but not computer chess progr.

Posted: Sat Dec 18, 2010 4:24 pm
by Solitaireman
Image
Image
Image


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

Re: OFF-topic. Just programming but not computer chess progr

Posted: Sat Dec 18, 2010 6:56 pm
by hyatt
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.

Re: OFF-topic. Just programming but not computer chess progr

Posted: Sat Dec 25, 2010 9:49 am
by mcostalba
Solitaireman wrote:Please no tricks but only a general way
Use an array of structs
Solitaireman wrote:In fact i would be very thankful if anyone could solve the whole (small and quick) problem for me
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).