Skip to content

Commit bbc0b34

Browse files
committed
Fix type error - defibrillator instead of defibrilator
1 parent 73f6435 commit bbc0b34

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

Training/Easy/defibrillators.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Solution for https://www.codingame.com/ide/puzzle/defibrillators
22
class Defibrillators
3-
attr_accessor :lon, :lat, :n, :defibrilators
3+
attr_accessor :lon, :lat, :n, :defibrillators
44

55
def initialize
66
@lon = parse(gets.chomp)
77
@lat = parse(gets.chomp)
88
@n = gets.to_i
9-
@defibrilators = {}
9+
@defibrillators = {}
1010
end
1111

1212
def calculate_x(d_long, d_lat)
@@ -26,11 +26,11 @@ def parse(var)
2626
(var.sub(',', '.').to_f * Math::PI) / 180
2727
end
2828

29-
def find_closest(defibrilators_hash)
30-
min = defibrilators_hash.values.first
31-
closest_name = defibrilators_hash.keys.first
29+
def find_closest(defibrillators_hash)
30+
min = defibrillators_hash.values.first
31+
closest_name = defibrillators_hash.keys.first
3232

33-
defibrilators_hash.map do |key, value|
33+
defibrillators_hash.map do |key, value|
3434
if value < min
3535
min = value
3636
closest_name = key
@@ -39,18 +39,18 @@ def find_closest(defibrilators_hash)
3939
closest_name
4040
end
4141

42-
def init_defibrilators(defibrilator)
43-
d_long = parse(defibrilator[4])
44-
d_lat = parse(defibrilator[5])
42+
def init_defibrillators(defibrillator)
43+
d_long = parse(defibrillator[4])
44+
d_lat = parse(defibrillator[5])
4545
x = calculate_x(d_long, d_lat)
4646
y = calculate_y(d_lat)
47-
defibrilators[defibrilator[1]] = distance(x, y)
47+
defibrillators[defibrillator[1]] = distance(x, y)
4848
end
4949

5050
def start
5151
n.times do
5252
defib = gets.chomp
53-
init_defibrilators(defib.split(';'))
53+
init_defibrillators(defib.split(';'))
5454
end
5555
puts find_closest(defibrillators)
5656
end

0 commit comments

Comments
 (0)