Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

payout_system

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

payout_system

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Payout System

Schemes for selecting winners and their prizes in a pool betting application.

This is used at Picklive. See also: Picklive tech blog.

Example:

class Entry
  attr_accessor :points
  def initialize(points)
    self.points = points
  end
end
entries = [34, 61, 73, 17, 45, 18, 93, 102, 46].map{ |points| Entry.new(points) }

pot_amount = 1000
payouts = PayoutSystem.calculate(pot_amount, entries, :podium_split, :points)

# It returns a collection of [Entry, prize_amount]:
# => [[#<Entry:0x1019a9a00 @points=102>, 700],
#     [#<Entry:0x1019a99d8 @points=99>, 200],
#     [#<Entry:0x1019a99b0 @points=84>, 100]]

Available payout systems

  • winner_takes_all - 1st place wins the pot
  • podium_split - 1st, 2nd, 3nd place win 70%, 20%, 10% of the pot
  • minimum_to_fraction - first 25% of players get back a minimum (this can be their stake), and the top 3 splits the remaining sum according to podium_split rules

FAQs

Package last updated on 04 Nov 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc