ofcp_card_counter 0.0.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/lib/ofcp_card_counter/card_counter.rb +17 -0
- data/lib/ofcp_card_counter/version.rb +1 -1
- data/ofcp_card_counter.gemspec +1 -0
- metadata +16 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 4a7db1c369a3f53e929f1dd91dec95f997937138
         | 
| 4 | 
            +
              data.tar.gz: e119cf48733a3852042c82bd0c26b3c3b89c74fb
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c5ed956225a1d03adc79297006eee98e61b2461a54661bf7734d85e0877bb402c37e5ee1b74374370228c1c46d3361d20935b243b5942a5d57b075878f0d1e65
         | 
| 7 | 
            +
              data.tar.gz: 8613ec66e3cfb074d44b82f133ac60edb713be4bcaddd1481169321f1b2b7c3b8e69ff9ca9cccf1873b687bc3f1306965d1437030c2bee6f799d7a8ef7236df8
         | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
| @@ -1,9 +1,26 @@ | |
| 1 1 | 
             
            class OfcpCardCounter::CardCounter
         | 
| 2 | 
            +
              # Creates a new instance of CardCounter
         | 
| 3 | 
            +
              #
         | 
| 4 | 
            +
              # @param [Hash] options :turns_left:
         | 
| 5 | 
            +
              # @option options [Number] :turns_left the number of cards yet to be dealt to the player
         | 
| 6 | 
            +
              # @option options [Array<String>]  :cards a collection containing the cards that are already known
         | 
| 7 | 
            +
              # @return [CardCounter] a fresh new instance of CardCounter
         | 
| 2 8 | 
             
              def initialize(options={})
         | 
| 3 9 | 
             
                @turns_left = options[:turns_left]
         | 
| 4 10 | 
             
                @cards      = options[:cards]
         | 
| 5 11 | 
             
              end
         | 
| 6 12 |  | 
| 13 | 
            +
              # Calculate the dependent probability of receiving a specific quantity of
         | 
| 14 | 
            +
              # of cards from a pool of desired options
         | 
| 15 | 
            +
              #
         | 
| 16 | 
            +
              # @param [Number] number the number of cards from the desired array that you need
         | 
| 17 | 
            +
              # @param [Hash] options
         | 
| 18 | 
            +
              # @option options [Array<String>] :of the pool of cards you desire
         | 
| 19 | 
            +
              # @return [Float] dependent probability as a scalar between 0 and 1
         | 
| 20 | 
            +
              # @example probability of getting 2 of the 3 remaining 4's
         | 
| 21 | 
            +
              #   @card_counter = OfcpCardCounter::CardCounter.new(:turns_left => 2, :cards => %w{4S 3H 3D})
         | 
| 22 | 
            +
              #   @card_counter.probability_of_getting(2, :of => %w{4H 4D 4C}) #=> 0.002551020408163265
         | 
| 23 | 
            +
             | 
| 7 24 | 
             
              def probability_of_getting(number, options={})
         | 
| 8 25 | 
             
                return 1.0 if number <= 0 || options[:of].nil?
         | 
| 9 26 |  | 
    
        data/ofcp_card_counter.gemspec
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: ofcp_card_counter
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0 | 
| 4 | 
            +
              version: 0.9.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Roy van de Water
         | 
| @@ -52,6 +52,20 @@ dependencies: | |
| 52 52 | 
             
                - - '>='
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 54 | 
             
                    version: '0'
         | 
| 55 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            +
              name: yard
         | 
| 57 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - '>='
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: '0'
         | 
| 62 | 
            +
              type: :development
         | 
| 63 | 
            +
              prerelease: false
         | 
| 64 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                requirements:
         | 
| 66 | 
            +
                - - '>='
         | 
| 67 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            +
                    version: '0'
         | 
| 55 69 | 
             
            description: Open Face Chinese Poker Statistics
         | 
| 56 70 | 
             
            email:
         | 
| 57 71 | 
             
            - me@royvandewater.com
         | 
| @@ -102,3 +116,4 @@ summary: Statistics calculations for Open Face Chinese Poker hands | |
| 102 116 | 
             
            test_files:
         | 
| 103 117 | 
             
            - spec/card_counter_spec.rb
         | 
| 104 118 | 
             
            - spec/spec_helper.rb
         | 
| 119 | 
            +
            has_rdoc: 
         |