rubygoal-core 1.0.0 → 1.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 +4 -4
- data/lib/rubygoal/moveable.rb +2 -1
- data/lib/rubygoal/recorder.rb +14 -17
- data/lib/rubygoal/version.rb +1 -1
- data/test/recorder_test.rb +19 -22
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03ea48a45147ab75f1cf9fd801c276abbc18ac2a
|
|
4
|
+
data.tar.gz: 193e95c0fe4a59656a0b92fccd47e9135ec921e5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f76d25a6e2111f584d054bcc47f4bac863dd2ebbbeb36a925c3a2d9154861e685c8745ef08560d53a23a8d6ce19be896ac735fc6e3f27ca8d0b0970c3dcb481b
|
|
7
|
+
data.tar.gz: 90184605c4bb9a2fe4c17c89251f524fa53ed5ce3626d0f905e27913119acba3732e2b974b4ba7cd43ceed88320c9e52d76a3b3f4cca817dd84ff10d74eb3b23
|
data/lib/rubygoal/moveable.rb
CHANGED
data/lib/rubygoal/recorder.rb
CHANGED
|
@@ -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:
|
|
36
|
-
ball:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
data/lib/rubygoal/version.rb
CHANGED
data/test/recorder_test.rb
CHANGED
|
@@ -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
|
-
|
|
45
|
+
[0, 0],
|
|
49
46
|
frames.first[:score]
|
|
50
47
|
)
|
|
51
48
|
assert_equal(
|
|
52
|
-
|
|
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[:
|
|
62
|
-
away_players = first_frame[:
|
|
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[:
|
|
73
|
-
away_players = first_frame[:
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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.
|
|
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:
|
|
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.
|
|
134
|
+
rubygems_version: 2.6.11
|
|
135
135
|
signing_key:
|
|
136
136
|
specification_version: 4
|
|
137
137
|
summary: Rubygoal core
|