public void GetCombinationsMaskBits_8_2() { ulong[] result = { 0x40, 0x80 }; MaskBits mask = new MaskBits(8, 2); Assert.Equal(true, mask.Equals(result)); }
private void Decrement(MaskBits mask, int j) { for (int i = 0; i < j; i++) { mask.Decrement(); } }
public void CompareArrays_DifferentMask_False() { var mask1 = new MaskBits(8, 2); var mask2 = new MaskBits(9, 2); Assert.Equal(false, mask1.Equals(mask2.Mask)); }
public void CompareArrays_SameReferences_True() { var mask1 = new MaskBits(8, 2); var mask2 = mask1.Mask; Assert.Equal(true, mask1.Equals(mask2)); }
// Bit 8 and 7 to one, if decrements bit 8 and 6 to one, bit 7 to 0 public void Decrement_8_7_Is_8_6() { ulong[] result = { 0x20, 0x80 }; MaskBits mask = new MaskBits(8, 2); mask.Decrement(); Assert.Equal(true, mask.Equals(result)); }
public void Decrement_8_1_Is_7_6() { ulong[] result = { 0x20, 0x40 }; MaskBits mask = new MaskBits(8, 2); Decrement(mask, 7); Assert.Equal(true, mask.Equals(result)); }
public void GetCombinationsMaskBits_8_2_Decrement_1_Reset() { ulong[] result = { 0x40, 0x80 }; MaskBits mask = new MaskBits(8, 2); mask.Decrement(); mask.Reset(); Assert.Equal(true, mask.Equals(result)); }
public void Decrement_2_1_Is_2_1() { ulong[] result = { 0x1, 0x2 }; MaskBits mask = new MaskBits(8, 2); Decrement(mask, 7); Decrement(mask, 6); Decrement(mask, 5); Decrement(mask, 4); Decrement(mask, 3); Decrement(mask, 2); mask.Decrement(); Assert.Equal(true, mask.Equals(result)); Assert.Equal(true, mask.IsParsingComplete); }
public static int GenerateAllCombinations(int numCards, int combinations) { var mask = new MaskBits(numCards, combinations); var totalCombinations = BinaryOperations.GetNumberOfCombinations(52ul, 7ul); var numCombinations = 0; using (var file = new StreamWriter(@"poker-all-" + combinations + "-hands.txt")) { while (!mask.IsParsingComplete) { file.WriteLine(mask.ToUint64()); mask.Decrement(); numCombinations++; ConsoleHelper.DrawProgressBar(numCombinations, totalCombinations); } } return(numCombinations); }
public void GetCombinationsMaskBits_52_7() { // 0000 0000 0000//1000 0000.0000 0/000.0000 0000.00/00 0000.0000 000/0.0000 0000.0000 // 0000 0000 0000//0100 0000.0000 0/000.0000 0000.00/00 0000.0000 000/0.0000 0000.0000 // 0000 0000 0000//0010 0000.0000 0/000.0000 0000.00/00 0000.0000 000/0.0000 0000.0000 // 0000 0000 0000//0001 0000.0000 0/000.0000 0000.00/00 0000.0000 000/0.0000 0000.0000 // 0000 0000 0000//0000 1000.0000 0/000.0000 0000.00/00 0000.0000 000/0.0000 0000.0000 // 0000 0000 0000//0000 0100.0000 0/000.0000 0000.00/00 0000.0000 000/0.0000 0000.0000 // 0000 0000 0000//0000 0010.0000 0/000.0000 0000.00/00 0000.0000 000/0.0000 0000.0000 ulong[] result = { 0x200000000000, 0x400000000000, 0x800000000000, 0x1000000000000, 0x2000000000000, 0x4000000000000, 0x8000000000000 }; MaskBits mask = new MaskBits(52, 7); Assert.Equal(true, mask.Equals(result)); }
public override int GetHashCode() { return(CategoryBits.GetHashCode() + MaskBits.GetHashCode() + GroupIndex.GetHashCode()); }
public void CompareArrays_Null_False() { var mask1 = new MaskBits(8, 2); Assert.Equal(false, mask1.Equals(null)); }
public void MaskBits_8_2_ToString_Is_11000000() { var mask = new MaskBits(8, 2); Assert.Equal("11000000", mask.ToString()); }
public void GetCombinationsMaskBits_8_1() { ulong[] result = { 0x80 }; MaskBits mask = new MaskBits(8, 1); Assert.Equal(true, mask.Equals(result)); }
/// <summary> /// Convert this FilterData to a human-readable format. /// </summary> /// <returns>The formatted string</returns> public override string ToString() { return("CategoryBits=" + CategoryBits.ToString() + " MaskBits=" + MaskBits.ToString() + " GroupIndex=" + GroupIndex.ToString()); }