perfect_season_odds 0.1.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 +7 -0
- data/LICENSE +9 -0
- data/README.md +14 -0
- data/lib/perfect_season_odds.rb +32 -0
- metadata +45 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 30fe47e9022852e3471baa090a82da39e8fe42c4ae597e7bf6a398cfb3a74f4b
|
|
4
|
+
data.tar.gz: 1fbc04d31738872b8c7650fed6c2c013426afc7fd82e4f6e058a1a5277895bd3
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b52fec88283f2c2a507b2187b81c2fc4457a6e92e9bf9c7555154decea1775faaf02809f5d1faa17336d9999d8b2593fc040225402ce27a907a872720b992891
|
|
7
|
+
data.tar.gz: a38303ed19986c9e7bfff30768b70bd3a70410bdda20ba765af99dd7aef2d6acd42a8d14a76e5cbe77ea98a96094ad9da0b0b2c0bd9ec67d23b6193e827470aa
|
data/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 17-0 Game
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
|
data/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# perfect_season_odds
|
|
2
|
+
|
|
3
|
+
Tiny Ruby helpers for perfect-season math: the chance a team wins every game.
|
|
4
|
+
|
|
5
|
+
```ruby
|
|
6
|
+
require "perfect_season_odds"
|
|
7
|
+
PerfectSeasonOdds.flat(0.90) # => 0.1668 (90% favorite every week, 17 games)
|
|
8
|
+
PerfectSeasonOdds.undefeated([0.7, 0.65, 0.6])
|
|
9
|
+
PerfectSeasonOdds.no_vig(-300, +250) # vig-free win probabilities
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Made by the team behind [17-0 Game](https://17-0game.org/), a free browser NFL roster and season sim where you try to go 17-0.
|
|
13
|
+
|
|
14
|
+
License: MIT
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Small helpers for "can a team go 17-0?" style questions.
|
|
4
|
+
# Companion to 17-0 Game (https://17-0game.org/), a browser NFL roster and season sim.
|
|
5
|
+
module PerfectSeasonOdds
|
|
6
|
+
VERSION = "0.1.0"
|
|
7
|
+
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
# Probability of winning every game, given per-game win probabilities (0..1).
|
|
11
|
+
def undefeated(probs)
|
|
12
|
+
probs.reduce(1.0) { |acc, p| acc * Float(p) }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Same probability for a flat per-game win probability over n games (default 17).
|
|
16
|
+
def flat(p, games = 17)
|
|
17
|
+
Float(p)**games
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Convert an American moneyline to an implied win probability (vig included).
|
|
21
|
+
def implied(moneyline)
|
|
22
|
+
ml = Float(moneyline)
|
|
23
|
+
ml.negative? ? -ml / (-ml + 100.0) : 100.0 / (ml + 100.0)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Remove the vig from a two-way market and return [p_a, p_b].
|
|
27
|
+
def no_vig(ml_a, ml_b)
|
|
28
|
+
a = implied(ml_a)
|
|
29
|
+
b = implied(ml_b)
|
|
30
|
+
[a / (a + b), b / (a + b)]
|
|
31
|
+
end
|
|
32
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: perfect_season_odds
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- 17-0 Game
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: Multiply per-game win probabilities, convert moneylines, and remove vig
|
|
13
|
+
to estimate the odds of an undefeated season. Companion to 17-0 Game.
|
|
14
|
+
email: contact@17-0game.org
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- LICENSE
|
|
20
|
+
- README.md
|
|
21
|
+
- lib/perfect_season_odds.rb
|
|
22
|
+
homepage: https://17-0game.org/
|
|
23
|
+
licenses:
|
|
24
|
+
- MIT
|
|
25
|
+
metadata:
|
|
26
|
+
homepage_uri: https://17-0game.org/
|
|
27
|
+
source_code_uri: https://gitlab.com/the170game
|
|
28
|
+
rdoc_options: []
|
|
29
|
+
require_paths:
|
|
30
|
+
- lib
|
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
32
|
+
requirements:
|
|
33
|
+
- - ">="
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: '2.7'
|
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
requirements: []
|
|
42
|
+
rubygems_version: 3.6.7
|
|
43
|
+
specification_version: 4
|
|
44
|
+
summary: Perfect-season (e.g. NFL 17-0) probability helpers
|
|
45
|
+
test_files: []
|