甲撲克甲板52卡
13秩和4西裝撲克手錶示和評價
高效手錶示和評價
A K Q J T 9 8 7 6 5 4 3 2
scdh scdh scdh scdh scdh scdh scdh scdh scdh scdh scdh scdh scdh
52比特
如,AC,QS工作Qh,8s,7s 6s
A K Q J T 9 8 7 6 5 4 3 2
scdh scdh scdh scdh scdh scdh scdh scdh scdh scdh scdh scdh scdh
1 1 1 1 1 1 1
It在9卡36位被打破
這是罰款,直至最後一組
byte s = 1;
UInt16 spades4 = (UInt16)((s << 12) + (s << 8) + (s << 4) + (s & 0xff));
Debug.WriteLine("Hexadecimal value of {0} is {1} {2}", spades4, String.Format("{0:X}", spades4), Convert.ToString(spades4, 2).PadLeft(16, '0'));
Debug.WriteLine("");
UInt32 spades8 = (UInt32)((s << 28) + (s << 24) + (s << 20) + (s << 16) + (s << 12) + (s << 8) + (s << 4) + (s & 0xff));
Debug.WriteLine("Hexadecimal value of {0} is {1} {2}", spades8, String.Format("{0:X}", spades8), Convert.ToString(spades8, 2).PadLeft(32, '0'));
Debug.WriteLine("");
Int64 spades9 = (Int64)((s << 30) + (s << 28) + (s << 24) + (s << 20) + (s << 16) + (s << 12) + (s << 8) + (s << 4) + (s & 0xff));
Debug.WriteLine("Hexadecimal value of {0} is {1} {2}", spades9, String.Format("{0:X}", spades9), Convert.ToString(spades9, 2).PadLeft(36, '0'));
Debug.WriteLine("");
// once the shift is up to 31 it breaks - it goes negative
Int64 spades9b = (Int64)((Int64)(s << 31) + (Int64)(s << 28) + (Int64)(s << 24) + (Int64)(s << 20) + (Int64)(s << 16) + (Int64)(s << 12) + (Int64)(s << 8) + (Int64)(s << 4) + (Int64)(s & 0xff));
Debug.WriteLine("Hexadecimal value of {0} is {1} {2}", spades9b, String.Format("{0:X}", spades9b), Convert.ToString(spades9b, 2).PadLeft(36, '0'));
Debug.WriteLine("");
我試圖UINT64和同樣的問題
我覺得這是修復
不知道我應該刪除的離開這件事
Int64 spades9b = (Int64)(((Int64)s << 44) | ((Int64)s << 40) | ((Int64)s << 36) | ((Int64)s << 32) | (Int64)(s << 28) | (Int64)(s << 24) | (Int64)(s << 20) | (Int64)(s << 16) | (Int64)(s << 12) | (Int64)(s << 8) | (Int64)(s << 4) | (Int64)(s & 0xff));
Debug.WriteLine("Hexadecimal value of {0} is {1} {2}", spades9b, String.Format("{0:X}", spades9b), Convert.ToString(spades9b, 2).PadLeft(48, '0'));
我認爲這是修正((Int64)s << 32) – Paparazzi
希望你這樣做只是爲了好玩,因爲已經存在非常高效的撲克牌手評估算法。 – Evk
@Evk你可以指點我在C#中的一個嗎? – Paparazzi