Texas Hold'em
In this challenge you are asked to code an alias that will return what the score of a player's hand is.
Card naming scheme
| A | Ace |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| 5 | 5 |
| 6 | 6 |
| 7 | 7 |
| 8 | 8 |
| 9 | 9 |
| 10 | 10 |
| J | Jack |
| Q | Queen |
| K | King |
| | |
| D | Diamond |
| H | Heart |
| S | Spade |
| C | Club |
Specfications
The alias will accept one parameter ($1) which should be exactly seven cards.
Each card is seperated by a space and represented in the format:
[card][suit]
Parameter one ($1) is the only used parameter; all of the other parameters ($2-) should be ignored.
Potential
incorrect inputs may include (but are not limited to) the following:
Incorrect number of cards (not 7 cards)Duplicate cards (pay attention to this one!)Incorrect card formatting, e.g. 4DD instead of 4D
In each of these cases and any other erroneous inputs, the identifier should return $null. You will assume
anything can be supplied as a parameter.
All of the above conditions will be checked.
Your alias must be
case-insensitive, e.g. "4d" is the same as "4D".
Scoring System
In terms of the scoring system, it is up to you to come up with a scoring system. Whatever scoring system you use, you have to follow this simple rule;
the higher the number, the higher the hand is rated, e.g. 500 could be three of a kind, 400 could be two pair.
You are allowed to use decimals, or even negative values, just as long as it follows the above rule.
Do not forget you need to factor in high cards and kickers. You should always have five cards factored into your score.
Hands & Their Rank
Example:
$holdem(4C 4H 10D AC AS 4D 7C)
$holdem(AH 10C 3H 4H 6S 2C 5D)
$holdem(AS JS QS KS 4S 10S 2C)
$holdem(8C 10C 9C 6C 7S 7C AD)
$holdem(QH 2S 7D QC 5D QD QS)
$holdem(KD 9D 7D 5D AS 2D JC)
$holdem(8D 7C 6D JS QH 5S 4H)
$holdem(KC QH QS 7C 4H QC 9D)
$holdem(2D JS 10H 9D 8S JD 9H)
$holdem(4S KC 9D 8S 4H KH QD)
$holdem(KC QS 8D 5S 2D AS 3D)
$holdem(Kd Ks Kh Kc As)
$holdem(Kd Ks Kh Kc As 10s Kd)
$holdem(K10 Kh 9s 10h 2s J9 7d)
$holdem(K J Q 10 9 8 7)
Hand
Fours full of Aces
Straight 2-6
Royal Flush
Straight flush 6-10
Four of a kind, queens, 7 kicker
Flush, diamods, king high
Straight, 4-8
Three of a kind, queens, King kicker
Two pair, Jacks and Nines, 10 kicker
Two pair, Kings and fours, Queen kicker
Ace High
$null
$null
$null
$null
* These examples do NOT specifically represent what the alias should return. They should only be used as a reference.
External sources
Rules:
Alias name must be 'holdem'No dlls, coms, sockets or regular expressionsOne submission per user.Script must give correct results after consecutive runs.
Testing conditions:
Alias will be run on mIRC v6.21 and loaded into the remotes section.Your code will be taken for EXACTLY as-is.Alias will be run on a mIRC with no variables set - a clean mIRC.
Countcode:
(this is a temporary replacement for countcode... JavaScript needs to be enabled.)