rubygoal-core 1.0.0 → 1.1.0

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
  SHA1:
3
- metadata.gz: b9467e3e2d813c7e05c2b773fa9552c551c1b3d1
4
- data.tar.gz: 547398aa354e4077b01b0348ce7f70cfca999880
3
+ metadata.gz: 03ea48a45147ab75f1cf9fd801c276abbc18ac2a
4
+ data.tar.gz: 193e95c0fe4a59656a0b92fccd47e9135ec921e5
5
5
  SHA512:
6
- metadata.gz: 878e490f660c88b9809959c5839833413b4d8dd5fbd7243615b82a2760d335467499c3cf8e03234442a385348665c452fe9bc1e46a132102b57a7cc5e25a11e7
7
- data.tar.gz: 5497617e5e87057f6d235461a3a73f7e74cf53b88ce8eed99d4b583b74227aa78f321355dd27723527d6925ad2e715e0d179be84968f1f4dcd9d71fe63fe6fd2
6
+ metadata.gz: f76d25a6e2111f584d054bcc47f4bac863dd2ebbbeb36a925c3a2d9154861e685c8745ef08560d53a23a8d6ce19be896ac735fc6e3f27ca8d0b0970c3dcb481b
7
+ data.tar.gz: 90184605c4bb9a2fe4c17c89251f524fa53ed5ce3626d0f905e27913119acba3732e2b974b4ba7cd43ceed88320c9e52d76a3b3f4cca817dd84ff10d74eb3b23
@@ -55,10 +55,11 @@ module Rubygoal
55
55
  position.add(movement)
56
56
  end
57
57
 
58
+ attr_accessor :destination
59
+
58
60
  private
59
61
 
60
62
  attr_reader :speed
61
- attr_accessor :destination
62
63
 
63
64
  def reset_rotation
64
65
  self.rotation = 0
@@ -17,10 +17,7 @@ module Rubygoal
17
17
  home: @game.coach_home.name,
18
18
  away: @game.coach_away.name
19
19
  },
20
- score: {
21
- home: @game.score_home,
22
- away: @game.score_away
23
- },
20
+ score: [@game.score_home, @game.score_away],
24
21
  frames: @frames
25
22
  }
26
23
  end
@@ -32,24 +29,24 @@ module Rubygoal
32
29
  def frame_info
33
30
  {
34
31
  time: @game.time.round(0),
35
- score: { home: @game.score_home, away: @game.score_away },
36
- ball: {
37
- x: @game.ball.position.x.round(0),
38
- y: @game.ball.position.y.round(0)
39
- },
40
- home_players: team_info(@game.team_home),
41
- away_players: team_info(@game.team_away)
32
+ score: [@game.score_home, @game.score_away],
33
+ ball: [
34
+ @game.ball.position.x.round(0),
35
+ @game.ball.position.y.round(0)
36
+ ],
37
+ home: team_info(@game.team_home),
38
+ away: team_info(@game.team_away)
42
39
  }
43
40
  end
44
41
 
45
42
  def team_info(team)
46
43
  team.players.map do |_, player|
47
- {
48
- x: player.position.x.round(0),
49
- y: player.position.y.round(0),
50
- angle: player.rotation.round(0),
51
- type: player.type
52
- }
44
+ [
45
+ player.position.x.round(0),
46
+ player.position.y.round(0),
47
+ player.rotation.round(0),
48
+ player.type[0]
49
+ ]
53
50
  end
54
51
  end
55
52
  end
@@ -1,3 +1,3 @@
1
1
  module Rubygoal
2
- VERSION = Gem::Version.new '1.0.0'
2
+ VERSION = Gem::Version.new '1.1.0'
3
3
  end
@@ -24,10 +24,7 @@ module Rubygoal
24
24
  end
25
25
 
26
26
  def test_recorded_score
27
- expected_score = {
28
- home: 0,
29
- away: 0
30
- }
27
+ expected_score = [0, 0]
31
28
 
32
29
  assert_equal expected_score, recorder.to_hash[:score]
33
30
  end
@@ -45,11 +42,11 @@ module Rubygoal
45
42
  assert_equal 1, frames.count
46
43
  assert_in_delta 120, frames.first[:time], 0.001
47
44
  assert_equal(
48
- { home: 0, away: 0 },
45
+ [0, 0],
49
46
  frames.first[:score]
50
47
  )
51
48
  assert_equal(
52
- { x: ball_position.x, y: ball_position.y},
49
+ [ball_position.x, ball_position.y],
53
50
  frames.first[:ball]
54
51
  )
55
52
  end
@@ -58,8 +55,8 @@ module Rubygoal
58
55
  @game.update
59
56
 
60
57
  first_frame = recorder.to_hash[:frames].first
61
- home_players = first_frame[:home_players]
62
- away_players = first_frame[:away_players]
58
+ home_players = first_frame[:home]
59
+ away_players = first_frame[:away]
63
60
 
64
61
  assert_equal 11, home_players.count
65
62
  assert_equal 11, away_players.count
@@ -69,29 +66,29 @@ module Rubygoal
69
66
  @game.update
70
67
 
71
68
  first_frame = recorder.to_hash[:frames].first
72
- home_players = first_frame[:home_players]
73
- away_players = first_frame[:away_players]
69
+ home_players = first_frame[:home]
70
+ away_players = first_frame[:away]
74
71
 
75
72
  goalkeeper_field_pos = Position.new(50, Field::HEIGHT / 2)
76
73
  goalkeeper_pos_home = Field.absolute_position(goalkeeper_field_pos, :home)
77
74
  goalkeeper_pos_away = Field.absolute_position(goalkeeper_field_pos, :away)
78
75
 
79
76
  assert_equal(
80
- {
81
- x: goalkeeper_pos_home.x,
82
- y: goalkeeper_pos_home.y,
83
- angle: 0,
84
- type: :average
85
- },
77
+ [
78
+ goalkeeper_pos_home.x,
79
+ goalkeeper_pos_home.y,
80
+ 0,
81
+ "a"
82
+ ],
86
83
  home_players.first
87
84
  )
88
85
  assert_equal(
89
- {
90
- x: goalkeeper_pos_away.x,
91
- y: goalkeeper_pos_away.y,
92
- angle: 0,
93
- type: :average
94
- },
86
+ [
87
+ goalkeeper_pos_away.x,
88
+ goalkeeper_pos_away.y,
89
+ 0,
90
+ "a"
91
+ ],
95
92
  away_players.first
96
93
  )
97
94
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygoal-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Bejar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-01 00:00:00.000000000 Z
11
+ date: 2017-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  requirements: []
133
133
  rubyforge_project:
134
- rubygems_version: 2.4.5
134
+ rubygems_version: 2.6.11
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Rubygoal core