physicist 0.1.1 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8e6b5748e0166acbf9e69a28946931999a82817
4
- data.tar.gz: f1abc35f92cf0157ffcd366602d0b5d722438930
3
+ metadata.gz: 25ec556fd4d506229e77d77f8d449b1c3d0f54b1
4
+ data.tar.gz: 0c1a334ccf5cbf505e87606ab54fc484947f4c00
5
5
  SHA512:
6
- metadata.gz: 6aab3cf912156901fa5051c0b2259feedc77bb960bedc59c049fadc4744e799d6d2c2e6ce7bc6222d0be2e80b6368eead4d9c8bf34d471d3c4c2710d90576f7e
7
- data.tar.gz: 74b51b92552615d50c7d7ab5f9f44ee43f3139a9fe897ca92913562285efb2976d68a2be5b07c65551d6cbf5dab9d7bb10d080be7054a229bc870efebdcb0c73
6
+ metadata.gz: 1925d82228e4c198913dd95e24a1884ffd3a1454300c1f00b771064054c795a6e667c154adf0326ac5a2eff264485c8078a0c406c85bb81b3e2a798e1bd8ec05
7
+ data.tar.gz: 4212d6b0ef66e42ca3018960b86949b7da0e6050136c7feb2e818231525819e47f6b5b80e98d46e03712a39053ba74f0577a40ae14b3e362f4dab859f62bd456
@@ -26,7 +26,6 @@ module Physicist
26
26
  end
27
27
 
28
28
  def at(t, obstacles:[])
29
- # p [ :body, at: t, pos: position, vel: velocity ]
30
29
  x0, _ = *position
31
30
  vx0,vy0 = *velocity
32
31
 
@@ -87,15 +86,10 @@ module Physicist
87
86
  end
88
87
 
89
88
  distance_travelled_in_x_axis_if_no_obstacles = vx * dt
90
- p [ :next_x_obs, at: ox, distance: distance_to_next_x_obstacle, distance_without_obs: distance_travelled_in_x_axis_if_no_obstacles ]
91
- # require 'pry'
92
- # binding.pry
93
89
 
94
90
  if distance_travelled_in_x_axis_if_no_obstacles.abs < distance_to_next_x_obstacle
95
- p [ :travel_x_less_than_obs_x ]
96
91
  yield [x0 + (vx*dt), vx]
97
92
  else
98
- p [ :travel_x_more_than_obs_x ]
99
93
  if vx > 0
100
94
  yield [next_x_obstacle.position[0]-width, 0]
101
95
  else
@@ -126,8 +120,8 @@ module Physicist
126
120
  yield [y0 + (vy * dt), vy ]
127
121
  else
128
122
  if vy > 0
129
- yield [next_y_obstacle.position[1] - 1.01, 0] # (height + 0.1), 0]
130
- else
123
+ yield [next_y_obstacle.position[1] - (height) - 0.001, 0]
124
+ else
131
125
  yield [next_y_obstacle.position[1] + next_y_obstacle.dimensions[1] + 0.1, 0]
132
126
  end
133
127
  end
@@ -31,7 +31,6 @@ module Physicist
31
31
  attr_accessor :scientist
32
32
 
33
33
  def setup(*)
34
- p [ :lab_setup! ]
35
34
  fire(
36
35
  create_scientist(
37
36
  scientist_id: scientist_id,
@@ -55,12 +54,8 @@ module Physicist
55
54
  end
56
55
 
57
56
  # TODO
58
- p [ :check_jump ]
59
57
  if window.button_down?(Gosu::KbUp)
60
- p [ :jump! ]
61
58
  fire(jump)
62
- else
63
- p [ :no_jump! ]
64
59
  end
65
60
  end
66
61
 
@@ -2,8 +2,6 @@ module Physicist
2
2
  module Laboratory
3
3
  class CreateScientistHandler
4
4
  def handle(scientist_id:, name:, title:, position:, velocity:)
5
- p [ :creating_space ]
6
-
7
5
  map_data = (
8
6
  [
9
7
  [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ],
@@ -20,7 +18,6 @@ module Physicist
20
18
 
21
19
  space = Space.create(grid_map: map_data)
22
20
 
23
- p [ :creating_scientist, name: name ]
24
21
  space.create_scientist(
25
22
  id: scientist_id,
26
23
  name: name,
@@ -3,7 +3,7 @@ module Physicist
3
3
  class MoveScientistHandler
4
4
  def handle(scientist_id:, direction:)
5
5
  scientist = Scientist.find(scientist_id)
6
- scientist.move(direction: direction)
6
+ scientist.move(direction: direction) if scientist # ???
7
7
  end
8
8
  end
9
9
  end
@@ -2,7 +2,6 @@ module Physicist
2
2
  module Laboratory
3
3
  class ScientistUpdatedEventListener < Metacosm::EventListener
4
4
  def receive(scientist_id:, position:, velocity:, updated_at:)
5
- p [ :scientist_updated, pos: position, vel: velocity ]
6
5
  scientist_view = ScientistView.find_by(scientist_id: scientist_id)
7
6
  scientist_view.update(
8
7
  position: position,
@@ -39,9 +39,7 @@ module Physicist
39
39
  dvx = direction == :left ? -speed : speed
40
40
  vxt = vx + dvx
41
41
  return unless vxt.abs < max_ground_speed
42
- p [ :move, dir: direction, current: current, dvx: dvx, vxt: vxt ]
43
42
 
44
- # TODO more specific event?
45
43
  update(
46
44
  position: current.position,
47
45
  velocity: [vxt, vy],
@@ -50,7 +48,6 @@ module Physicist
50
48
  end
51
49
 
52
50
  def jump
53
- p [ :jump, current: current ]
54
51
  vx, vy = *current.velocity
55
52
  return if vy.abs > 0.0
56
53
 
@@ -76,7 +73,7 @@ module Physicist
76
73
  position: position,
77
74
  velocity: velocity,
78
75
  t0: updated_at || Time.now,
79
- dimensions: [1,1]
76
+ dimensions: [2,2]
80
77
  )
81
78
  end
82
79
  end
@@ -37,7 +37,7 @@ module Physicist
37
37
  invert_x: false,
38
38
  asset_width: 64,
39
39
  asset_height: 64,
40
- scale: 1.0
40
+ scale: 2.0
41
41
  )
42
42
  end
43
43
 
@@ -27,7 +27,7 @@ module Physicist
27
27
  position: position,
28
28
  velocity: velocity,
29
29
  t0: t0 || Time.now,
30
- dimensions: [1,1]
30
+ dimensions: [2,2]
31
31
  )
32
32
  end
33
33
  end
@@ -8,7 +8,6 @@ module Physicist
8
8
  end
9
9
 
10
10
  def self.collection_from_tiles(tile_grid)
11
- # p [ :assembling_bodies_from_tiles, grid: tile_grid ]
12
11
  simple_bodies = []
13
12
 
14
13
  tile_grid.each_with_index do |row, y|
@@ -19,7 +18,6 @@ module Physicist
19
18
  end
20
19
  end
21
20
 
22
- # p [ bodies: simple_bodies ]
23
21
  simple_bodies
24
22
  end
25
23
  end
@@ -1,4 +1,4 @@
1
1
  module Physicist
2
2
  # physicist version
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
@@ -96,7 +96,7 @@ describe Body do
96
96
  _,vy = *body_at_t.velocity
97
97
  _,y = *body_at_t.position
98
98
  expect(vy).to eq(0)
99
- expect(y0 + 0.99).to eq(y)
99
+ expect(y0 - 0.001).to eq(y)
100
100
  end
101
101
  end
102
102
 
@@ -113,7 +113,7 @@ describe Body do
113
113
  it 'should stop vertical movement after 1s' do
114
114
  _,vy = *body_at_t.velocity
115
115
  _,y = *body_at_t.position
116
- expect(y0 + 10.79).to eq(y)
116
+ expect(y0 + 9.799).to eq(y)
117
117
  expect(vy).to eq(0)
118
118
  end
119
119
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: physicist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Weissman