basketball 0.0.20 → 0.0.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6742218e05c042c3cfe5c5ae155b4deaa22a8c1c1aeeac9c3ef2cdb69c38be42
4
- data.tar.gz: 3d151a9df301c7160f0e3884ff961a984f64d5071e2081e3e01eddff557069ab
3
+ metadata.gz: 3a6709626d10c4b4c46fce577ec25ea57f28f89a12a40799bd625666d9c6a3b5
4
+ data.tar.gz: ac30e12cb15484913ba3b58c0e96f130575a08111d572b87b77e490727c7a528
5
5
  SHA512:
6
- metadata.gz: d1a696a182a4b196030c79926591149d864c744fb27eab6c114800ee066f7edfb9cb340efda8ba96a96322d1bbf1dcf452e9777b678a91c71e9c31523743f165
7
- data.tar.gz: 4aac8527166debde576f7c91ff7e40aaf7bde42ec33214f96e8f86b66a174d5d8f65db31cca44be04c0c003f1ae631ef0454b8f650ad66957c95eff0b9494133
6
+ metadata.gz: f2fd8e0024222767369b33abf749ba8b41d6320d181bc6e20144007bf1a6aedf6d67f42f0d6ce29fd995387b9540eed9c8c8ec6232809a35c56099389b33cada
7
+ data.tar.gz: de054db63b667f81a118b2e917894bdb7667bc64801959529c74b9da2d19afc78889a3efa8ee95f68d098880fc82f449fd661a33f2eca668bcfe656b839a40ef
data/README.md CHANGED
@@ -12,6 +12,7 @@ Element | Description
12
12
  :------------ | :-----------
13
13
  **Arena** | Determines exhibition and regular season game outcomes.
14
14
  **Assessment** | When the Room needs to know who a Front Office wants to select, the Room will send the Front Office an Assessment. The Assessment is a report of where the team currently stands: players picked, players available, and round information.
15
+ **Available Player** | Represents a player in the context of a draft.
15
16
  **Calendar** | Stores important boundary dates (exhibition start, exhibition end, season start, and season end).
16
17
  **Conference** | A collection of Divisions.
17
18
  **Coordinator** | Object which can take a League, Calendar, Games, and an Arena and provide an iterable interface to enumerate through days and simulate games as results.
@@ -16,16 +16,18 @@ module Basketball
16
16
 
17
17
  private_constant :DEFAULT_MAX_STAR_LEVEL, :DEFAULT_MAX_RISK_LEVEL, :MAX_POSITIONS
18
18
 
19
- attr_reader :prioritized_positions, :risk_level, :star_level, :scout
19
+ attr_reader :name, :prioritized_positions, :risk_level, :star_level, :scout
20
20
 
21
21
  def initialize(
22
22
  id:,
23
+ name: '',
23
24
  prioritized_positions: [],
24
25
  risk_level: rand(0..DEFAULT_MAX_RISK_LEVEL),
25
26
  star_level: rand(0..DEFAULT_MAX_STAR_LEVEL)
26
27
  )
27
28
  super(id)
28
29
 
30
+ @name = name.to_s
29
31
  @risk_level = risk_level.to_i
30
32
  @star_level = star_level.to_i
31
33
  @prioritized_positions = prioritized_positions
@@ -6,6 +6,9 @@ module Basketball
6
6
  # and a collection of Player objects.
7
7
  class Team < Entity
8
8
  class PlayerNotSignedError < StandardError; end
9
+ class MaxPlayerCountError < StandardError; end
10
+
11
+ MAX_PLAYER_COUNT = 18
9
12
 
10
13
  attr_reader :players, :name
11
14
 
@@ -40,6 +43,7 @@ module Basketball
40
43
  def sign!(player)
41
44
  raise ArgumentError, 'player is required' unless player
42
45
  raise PlayerAlreadySignedError, "#{player} already signed by #{self}" if signed?(player)
46
+ raise MaxPlayerCountError, "max reached: #{MAX_PLAYER_COUNT}" if players.length >= MAX_PLAYER_COUNT
43
47
 
44
48
  players << player
45
49
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Basketball
4
- VERSION = '0.0.20'
4
+ VERSION = '0.0.22'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: basketball
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-16 00:00:00.000000000 Z
11
+ date: 2023-06-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: " This library is meant to serve as the domain for a basketball league/season
14
14
  simulator/turn-based game. It models core ideas such as: players, general managers,