All Projects → StefanKarpinski → Cards.jl

StefanKarpinski / Cards.jl

Licence: other
A package for representing hands of cards (quite compactly)

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to Cards.jl

rs-poker
No description or website provided.
Stars: ✭ 32 (-21.95%)
Mutual labels:  poker, cards
inkscape-extension-playing-cards
An Inkscape extension that creates templates for playing cards
Stars: ✭ 25 (-39.02%)
Mutual labels:  cards
deoplete-julia
deoplete.nvim source for julia. Providing julia Syntax Completions for julia, in Neovim (deprecated for julia 0.6+)
Stars: ✭ 12 (-70.73%)
Mutual labels:  julia-language
AbstractOperators.jl
Abstract operators for large scale optimization in Julia
Stars: ✭ 26 (-36.59%)
Mutual labels:  julia-language
pokerwars.io-starterbot-python
A starter bot written in python for the pokerwars.io platform. To play: pull this code, register on pokerwars.io, get your API token and play!
Stars: ✭ 37 (-9.76%)
Mutual labels:  poker
teleirc
Go implementation of a Telegram <=> IRC bridge for use with any IRC channel and Telegram group
Stars: ✭ 112 (+173.17%)
Mutual labels:  bridge
FaceDetection.jl
A face detection algorithm using Viola-Jones' rapid object detection framework written in Julia
Stars: ✭ 13 (-68.29%)
Mutual labels:  julia-language
hearthstone-card-images
(Archived, see below) Hearthstone card image repository
Stars: ✭ 63 (+53.66%)
Mutual labels:  cards
SwiftObjCBridge
A Swift Objective-C Bridge implemented using @dynamicCallable
Stars: ✭ 43 (+4.88%)
Mutual labels:  bridge
SDN-Datacenter
Making a software defined datacenter. Which includes various virtual networks with mutiple network functions deployed on it. This includes SDN network deployed on real hardware.
Stars: ✭ 28 (-31.71%)
Mutual labels:  bridge
PlutoTest.jl
✔️ Visual, reactive testing library for Julia. Time machine included.
Stars: ✭ 56 (+36.59%)
Mutual labels:  julia-language
41poker
a toolset for Texas Hold'em Poker
Stars: ✭ 13 (-68.29%)
Mutual labels:  poker
TimelineCards
Presenting timelines as cards, single or bundled in scrollable feed!
Stars: ✭ 423 (+931.71%)
Mutual labels:  cards
react-native-card-list
A React Native component which displays a list of image cards that zoom to fullscreen
Stars: ✭ 19 (-53.66%)
Mutual labels:  cards
cypherpoker.js
An open source peer-to-peer poker platform with cryptocurrency integration written in JavaScript.
Stars: ✭ 72 (+75.61%)
Mutual labels:  poker
BusinessDays.jl
📆 A highly optimized Business Days calculator written in Julia language. Also known as Working Days calculator.
Stars: ✭ 53 (+29.27%)
Mutual labels:  julia-language
TgTwitterStreamer
Continous Integration from Twitter to Telegram.
Stars: ✭ 55 (+34.15%)
Mutual labels:  bridge
HiveMind-core
Join the mycroft collective, utils for mycroft-core mesh networking
Stars: ✭ 72 (+75.61%)
Mutual labels:  bridge
JuliaAcademyMaterials
Assets and Infrastructure for JuliaAcademy.com
Stars: ✭ 60 (+46.34%)
Mutual labels:  julia-language
Julia
Algorithms implemented in the Julia programming language. We're collaborating with the Humans of Julia community!
Stars: ✭ 216 (+426.83%)
Mutual labels:  julia-language

Cards

Build Status Coverage Status codecov.io

This package defines three types:

  • Suit uses 2 low bits of a UInt8 to represent four suits of cards: , ♢, ♡, .

  • Card uses 6 low bits of a UInt8 to represent 64 possible card values:

    • 2 bits for the Suit (, ♢, ♡, )
    • 4 bits for the rank from 0-15, meaning:
      • 0 – low joker
      • 1 – low ace
      • 2-10 – number cards
      • 11-13 – jack, queen, king
      • 14 – high ace
      • 15 – high joker
  • Hand uses 64 bits of a UInt64 to represent all possible hands (sets) of cards.

The design of having high and low aces and jokers allows hands from many different games to be represented in a single scheme, with consistent rank ordering. If you're representing hands from a game with aces high, use the A♣, A♢, A♡, A♠ cards; if you're representing hands from a game with aces low, use the 1♣, 1♢, 1♡, 1♠ cards instead.

Example usage:

julia> using Cards

julia> hand = rand(Hand)
Hand([2♣, 3♣, 6♣, 7♣, 8♣, 9♣, 2♢, 3♢, 4♢, 7♢, 10♢, J♢, A♢, 4♡, 5♡, 6♡, 7♡, Q♡, K♡, A♡, 4♠, 6♠, 9♠, K♠, A♠])

julia> 2in hand
true

julia> 4in hand
false

julia> A♣ in hand
false

julia> A♠ in hand
true

julia> hand
Hand([4♡, 5♡, 6♡, 7♡, Q♡, K♡, A♡])

julia> hand
Hand([4♠, 6♠, 9♠, K♠, A♠])

julia> length(♣  hand)
6
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].