Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jamesmacaulay/poker-hands
A little library to score poker hands in Clojure
https://github.com/jamesmacaulay/poker-hands
Last synced: 22 days ago
JSON representation
A little library to score poker hands in Clojure
- Host: GitHub
- URL: https://github.com/jamesmacaulay/poker-hands
- Owner: jamesmacaulay
- Created: 2013-01-24T03:00:07.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-05-18T13:57:36.000Z (over 11 years ago)
- Last Synced: 2024-10-12T13:10:58.287Z (about 1 month ago)
- Language: Clojure
- Homepage:
- Size: 112 KB
- Stars: 12
- Watchers: 4
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# poker-hands
A little library to score [poker hands](http://en.wikipedia.org/wiki/List_of_poker_hands) in Clojure, inspired by the good times at [Toronto Coding Dojo](http://www.meetup.com/Toronto-Coding-Dojo/).
## Usage
Clone the repo and `lein repl`.
```clojure
(use '[poker-hands.core :only [hand beats? hand-category score]])(def hands [(hand "2d 10s 12c 12d 9h")
(hand "2h 10h 12h 11h 9h")
(hand "3s 5c 6d 8s 10h")])
;=> #'user/hands(-> (hands 0) (beats? (hands 2)))
;=> true(-> (hands 0) (beats? (hands 1)))
;=> false(map hand-category hands)
;=> (:one-pair :flush :high-card)(score (hands 0))
;=> [1 12 10 9 2 0](->> hands
(sort-by score)
(map hand-category))
;=> (:high-card :one-pair :flush)
```# Known Limitations
* Doesn't know anything about high/low aces, ranks are just numbers
## License
Copyright © 2013 James MacAulay
Distributed under the Eclipse Public License, the same as Clojure.