hlockey 1 → 2
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/bin/hlockey +45 -31
- data/lib/hlockey/data/election.yaml +16 -0
- data/lib/hlockey/data/information.yaml +12 -0
- data/lib/hlockey/data/league.yaml +846 -0
- data/lib/hlockey/data/links.yaml +2 -0
- data/lib/hlockey/data.rb +13 -0
- data/lib/hlockey/game.rb +159 -0
- data/lib/hlockey/league.rb +115 -0
- data/lib/hlockey/messages.rb +100 -0
- data/lib/hlockey/team.rb +35 -0
- data/lib/hlockey/version.rb +5 -0
- data/lib/hlockey.rb +3 -0
- metadata +17 -11
- data/lib/data/divisions.yaml +0 -845
- data/lib/data/season.rb +0 -27
- data/lib/game.rb +0 -158
- data/lib/league.rb +0 -140
- data/lib/messages.rb +0 -66
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e46193bf3b3f1113e7c57fe9bf55fa6c346abd442dd01d81e2431364f794a4f
|
4
|
+
data.tar.gz: e0b7f24304f815f861255a02f0966dd87c1614a62e5013de92c4e077c062e006
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2551f0b9e49f1222c6f7908027978380574b6fa160912ff46299bf206d8f3c8edd50dcb357b56608dfcb0300a5a5f181d4433b3486b02652788df9d51dd3853
|
7
|
+
data.tar.gz: f3c08d82574f1ddacb1e3faf04e200322b08ca1901fc8166bcd1cb47f9489e654c79d90a4ce04563cb609ce4fbb73222bb53c5a6e313449e5c14850d8623de08
|
data/bin/hlockey
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
# frozen_string_literal: true
|
4
4
|
|
5
|
-
|
6
|
-
require_relative('../lib/data/season')
|
5
|
+
require('hlockey')
|
7
6
|
|
8
7
|
def menu_input(default, *choices)
|
9
8
|
puts('Please enter a number...')
|
@@ -13,42 +12,49 @@ def menu_input(default, *choices)
|
|
13
12
|
puts("anything else - #{default}")
|
14
13
|
|
15
14
|
# Subtract 1 here to undo adding 1 earlier
|
16
|
-
gets.to_i - 1
|
15
|
+
STDIN.gets.to_i - 1
|
17
16
|
end
|
18
17
|
|
19
18
|
# Each element from choices should implement to_s
|
20
|
-
def menu_input_elem(
|
21
|
-
i = menu_input(
|
19
|
+
def menu_input_elem(choices)
|
20
|
+
i = menu_input('Back', *choices)
|
22
21
|
choices[i] unless i.negative?
|
23
22
|
end
|
24
23
|
|
25
|
-
|
26
|
-
|
24
|
+
def emoji_team(team)
|
25
|
+
"#{team.emoji} #{team}"
|
26
|
+
end
|
27
|
+
|
28
|
+
puts('Please wait...')
|
27
29
|
|
28
|
-
|
29
|
-
puts
|
30
|
-
.strftime("Season #{Season::NUMBER} starts at %H:%M on %A, %B %d.")
|
30
|
+
PRINT_TEAM_W_L = Proc.new do |team|
|
31
|
+
puts(" #{emoji_team(team).ljust(26)} #{team.w_l}")
|
31
32
|
end
|
32
33
|
|
34
|
+
league = Hlockey::League.new
|
35
|
+
|
36
|
+
puts(Hlockey::Messages.SeasonStarts(league.start_time)) if Time.now < league.start_time
|
37
|
+
|
33
38
|
loop do
|
34
39
|
league.update_state
|
35
40
|
|
36
|
-
puts(
|
41
|
+
puts(Hlockey::Messages.SeasonDay(league.day))
|
37
42
|
|
38
|
-
case menu_input('Exit', 'Games', 'Standings', '
|
43
|
+
case menu_input('Exit', 'Games', 'Standings', 'Team info', 'Election', 'Information')
|
39
44
|
when 0 # Games
|
40
|
-
if league.
|
41
|
-
puts(
|
45
|
+
if league.games.empty?
|
46
|
+
puts(Hlockey::Messages.NoGames)
|
42
47
|
next
|
43
48
|
end
|
44
49
|
|
45
|
-
game = menu_input_elem(
|
50
|
+
game = menu_input_elem(league.games)
|
46
51
|
next if game.nil?
|
47
52
|
|
53
|
+
puts("#{game.home.emoji} #{game} #{game.away.emoji}")
|
48
54
|
loop do
|
49
55
|
league.update_state
|
50
56
|
|
51
|
-
game.stream.each(&
|
57
|
+
game.stream.each(&method(:puts))
|
52
58
|
|
53
59
|
break unless game.in_progress
|
54
60
|
|
@@ -57,33 +63,41 @@ loop do
|
|
57
63
|
end
|
58
64
|
when 1 # Standings
|
59
65
|
if league.champion_team
|
60
|
-
puts(
|
61
|
-
"#{league.champion_team.name}!")
|
66
|
+
puts(Hlockey::Messages.SeasonChampion(league.champion_team))
|
62
67
|
elsif league.playoff_teams
|
63
68
|
puts('Playoffs')
|
64
|
-
league.playoff_teams.each(
|
69
|
+
league.playoff_teams.each(&PRINT_TEAM_W_L)
|
65
70
|
end
|
66
71
|
|
67
72
|
league.divisions.each do |name, teams|
|
68
73
|
puts(name)
|
69
|
-
|
74
|
+
teams.each(&PRINT_TEAM_W_L)
|
70
75
|
end
|
71
|
-
when 2 #
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
76
|
+
when 2 # Team info
|
77
|
+
team = menu_input_elem(league.teams)
|
78
|
+
next if team.nil?
|
79
|
+
|
80
|
+
puts(emoji_team(team))
|
81
|
+
team.roster.each do |pos, player|
|
82
|
+
puts(" #{Hlockey.pos_name(pos)}:\n #{player}")
|
83
|
+
player.stats.each { |stat, value| puts(" #{stat}: #{value.round(1)}") }
|
78
84
|
end
|
79
|
-
team.
|
85
|
+
puts(" wins: #{team.wins}")
|
86
|
+
puts(" losses: #{team.losses}")
|
80
87
|
when 3 # Election
|
81
|
-
|
88
|
+
election = Hlockey.load_data('election')
|
89
|
+
election.each do |category, options|
|
82
90
|
puts(category)
|
83
91
|
options.each { |name, description| puts(" #{name}: #{description}") }
|
84
92
|
end
|
85
|
-
puts(
|
86
|
-
|
93
|
+
puts('Go to the website (https://hlockey.herokuapp.com) to vote.')
|
94
|
+
when 4 # Information
|
95
|
+
Hlockey.load_data('information').each do |title, info|
|
96
|
+
puts(title)
|
97
|
+
info.each_line { |l| puts(" #{l}") }
|
98
|
+
end
|
99
|
+
puts('Links')
|
100
|
+
Hlockey.load_data('links').each { |site, link| puts(" #{site}: #{link}") }
|
87
101
|
else
|
88
102
|
exit
|
89
103
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
:Bribery:
|
3
|
+
:Flavor Text: Give each team a motto.
|
4
|
+
:Weather: Move all the stadiums outdoors.
|
5
|
+
:We Do A Little Losing: Recognize the losingest teams with an Underbracket.
|
6
|
+
:Treasure:
|
7
|
+
:Vengabus: All your team's stats are boosted by your team's losses * 0.005.
|
8
|
+
:Dave: The worst stat on your team is set to 4.5.
|
9
|
+
:Nice: Boost your worst player by 0.69 in every stat.
|
10
|
+
:Convenient Math Error: Your team starts the next season with 5 wins.
|
11
|
+
:Coaching:
|
12
|
+
:Please Block Shots: Move your team's best defensive player to goalie.
|
13
|
+
:Please Win Faceoffs: Move your team's player best offensive player to center.
|
14
|
+
:Draft: Replace your team's worst player with a random new player.
|
15
|
+
:Small Gamble: All your team's stats go up or down by 0.5 at random.
|
16
|
+
:Big Gamble: All your team's stats go up or down by 1.0 at random.
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
:Format: |-
|
3
|
+
Hlockey has 3 game long regular season matchups, & 5 game long postseason matchups.
|
4
|
+
The regular season is round robin format.
|
5
|
+
Teams play 2 regular season matchups against each other.
|
6
|
+
Playoffs are single-elimination tournaments.
|
7
|
+
The top 2 teams of each division qualify for playoffs.
|
8
|
+
Playoffs are perfectly seeded (best team plays worst team, etc).
|
9
|
+
:Relation to Blaseball: |-
|
10
|
+
Both Hlockey and Blaseball are splorts, therefore they have some similarities.
|
11
|
+
Breaks will usually be scheduled when Blaseball is more active.
|
12
|
+
Hlockey is inspired by Blaseball, & would most likely not exist without it.
|