Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/waterlink/competitions
Predicts how person will do in competition
https://github.com/waterlink/competitions
Last synced: about 1 month ago
JSON representation
Predicts how person will do in competition
- Host: GitHub
- URL: https://github.com/waterlink/competitions
- Owner: waterlink
- License: mit
- Created: 2015-04-12T06:20:15.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-12T07:38:52.000Z (over 9 years ago)
- Last Synced: 2024-10-16T07:16:35.719Z (3 months ago)
- Language: Ruby
- Size: 105 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Competition
Predicts how person will do in competition
It is an example how `protected` can be useful in Ruby.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'competition'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install competition
## Usage
```ruby
require "competition"
```### Creating Competition object
```ruby
person_a = Competition::Person.new(intelligence: 33, willpower: 20)
person_b = Competition::Person.new(intelligence: 47, willpower: 17)
person_c = Competition::Person.new(intelligence: 39, willpower: 25)competition = Competition::Competition.new
competition << person_a
competition << person_b
competition << person_c
```### Determining person predicted rating
```ruby
person_a.in_competition(competition).predicted_rating #=> 45.009699999999995
```## How it works
```
rating = affected_intelligence + 0.5 * affected_willpower, where:
affected_intelligence = intelligence * (1.03 ** more_intelligent_opponent_count)
affected_willpower = willpower * (0.97 ** less_intelligent_opponent_count)
```## Contributing
1. Fork it ( https://github.com/waterlink/competition/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request