Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion hand.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,13 @@ func MakeHandImpl(cardsIn CardSlice) *Hand {
h.val[0] = freqs[3][0]
h.val[1] = freqs[3][1]
h.ty = FULL_HOUSE
} else if (len(freqs[2]) > 0) {
return h
}
if (len(freqs[2]) > 0) {
h.val[0] = freqs[3][0]
h.val[1] = freqs[2][0]
h.ty = FULL_HOUSE
return h
}
}

Expand Down
13 changes: 12 additions & 1 deletion test-poker-odds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ diff "${tmp2}" "${tmp}" || die "unexpected result from test 3"
"${poker_odds}" -b 'KD KC 5H' -a 'KS QS' > "${tmp}"
cat << EOF > "${tmp2}"
results:
95.74% chance of three of a kind
66.60% chance of three of a kind
29.14% chance of a full house
4.26% chance of four of a kind
EOF
diff "${tmp2}" "${tmp}" || die "unexpected result from test 4"
Expand All @@ -55,3 +56,13 @@ results:
39.13% chance of a pair
EOF
diff "${tmp2}" "${tmp}" || die "unexpected result from test 5"

"${poker_odds}" -b "KD KH 2S" -a "KS QS" > "${tmp}"
cat << EOF > "${tmp2}"
results:
62.44% chance of three of a kind
4.16% chance of a flush
29.14% chance of a full house
4.26% chance of four of a kind
EOF
diff "${tmp2}" "${tmp}" || die "unexpected result from test 6"