![]() ![]() Return new RollScore(RollScoreType.ThreeOfAKind, three, (byte)(Array.LastIndexOf(diceCount, (byte)1) + 1)) Įlse if (Array.IndexOf(diceCount, (byte)2) >= 0)īyte highPair = (byte)(Array.LastIndexOf(diceCount, (byte)2) + 1) ![]() Return new RollScore(RollScoreType.FullHouse, Math.Max(pair, three), Math.Min(pair, three)) If (Array.IndexOf(diceCount, (byte)2) >= 0)īyte pair = (byte)(Array.IndexOf(diceCount, (byte)2) + 1) Return new RollScore(RollScoreType.FourOfAKind, (byte)(Array.IndexOf(diceCount, (byte)4) + 1), (byte)(Array.IndexOf(diceCount, (byte)1) + 1)) Įlse if (Array.IndexOf(diceCount, (byte)3) >= 0)īyte three = (byte)(Array.IndexOf(diceCount, (byte)3) + 1) Return new RollScore(RollScoreType.FiveOfAKind, (byte)(Array.IndexOf(diceCount, (byte)5) + 1), 0) Įlse if (Array.IndexOf(diceCount, (byte)4) >= 0) Static RollScore GetDiceScore(string input) Return string.Format("", type, highestDie, nextHighestDie) Public RollScore(RollScoreType type, byte highest, byte next) I used similar logic to another answer though: count the quantity of each number and base all the scoring on that: enum RollScoreType I decided to try myself, and I ended up not using regular expressions - I thought maybe with the simplicity of the searches required, regular expressions would add more complexity than they save. You can easily figure that out - you will need a bigger type to store result into :) What you will miss is the real strength of a hand. Speed would be enourmous, since the only operation you would need to do is convert number base, and the binary OR operation to extract a hand strenght. It will require about 46656 bytes (+ CPU alignment), and can fit into CPU L2 cache. 66655 - full house) is a number in base six (1-6), convert it into a base 10 number to get the index in the lookup table. Each byte can store all hand types as a binary representation (hopefully, if not use a short).Įach number you get (eg. You can have a lookup table, consisting of hands as indexes and associated with results (some hands can have multiple results) of that hand. Since you have only 46656 possible combinations and one byte can store the resulting hand strength, this problem is much easier than a poker hand problem. That is your mission, should you choose to accept it.I won't comment on how you seek the results, but rather on how you store the result for later lookup. What are the odds of getting making each of these hands with skill levels going from 1-5? A PC with 'Shooting 1', can reroll 1 die one with 'Shooting 2' can reroll 2, and so forth up to 5, which can reroll all. The higher the character's skill level, the more rerolls he can make (like Draw Poker). What are the odds of making each of these hands?īut that isn't the really hard question. The game relies on making (sorta) poker hands, with better hands beating worse hand in the following order: You have 5 poker dice, which go from 9-A (functionally the same as 1-6). So, I now challenge the math boffins with what I think is a hard one. Alright, every time I ask a dice probability question, I'm stunned at how quickly and thoroughly folks here can answer these questions. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |