Class: Physicist::Laboratory::CreateScientistHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/physicist/laboratory/handlers/create_scientist_handler.rb

Instance Method Summary collapse

Instance Method Details

#handle(scientist_id:, name:, title:, position:, velocity:) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/physicist/laboratory/handlers/create_scientist_handler.rb', line 4

def handle(scientist_id:, name:, title:, position:, velocity:)
  map_data = (
    [
      [ 1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1 ],
      [ nil, nil, nil, nil, nil, 1,   1,   nil, nil, nil, nil, 2,   1 ],
      [ nil, nil, nil, nil, nil, 1,   1,   nil, nil, nil, nil, nil, 1 ],
      [ nil, nil, nil, nil, nil, 1,   1,   nil, nil, nil, nil, nil, 1 ],
      [ nil, nil, nil, nil, nil, 1,   1,   nil, nil, nil, nil, nil, 1 ],
      [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 1 ],
      [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 3,   1 ],
      [ 1,   1,   nil, nil, 1,   1,   1,   1,   nil, nil, nil, 2,   1 ],
      [ 1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1]
    ]
  )

  space = Space.create(grid_map: map_data)

  space.create_scientist(
    id: scientist_id,
    name: name,
    title: title,
    position: position,
    velocity: velocity
  )
end