class Dungeon
attr_accessor :player
def initialize(player_name)
@player = Player.new(player_name)
@rooms = []
end
def add_room(reference, name, description, connections)
@rooms << Room.new(reference, name, description, connections)
end
def start(location)
@player.location = location
show_current_description
end
def show_current_description
puts find_room_in_dungeon(@player.location).full_description
end
def find_room_in_dungeon(reference)
@rooms.detect { |room| room.reference == reference}
end
def find_room_in_direction(direction)
find_room_in_dungeon(@player.location).connections[direction]
end
def go(direction)
puts “You go” + direction.to_s
@player.location = find_room_in_direction(direction)
show_current_description
end
class Player
attr_accessor :name, :location
def initilize(name)
@name = name
end
end
class Room
attr_accessor :reference, :name, :description, :connections
def initialize(reference, name, description, connections)
@reference = reference
@name = name
@description = description
@connections = connections
end
def full_description
@name + "\n\nYou are in" + @description
end
end
end
Create the main dungeon object
my_dungeon = Dungeon.new (“Dan Ge”)
Add rooms to the dungeon
my_dungeon.add_room(:moltencore, “Molten Core”, “Ragnoras the Firelord”,
{:west => :moltencorehoundroom})
my_dungeon.add_room(:moltencorehoundroom, “Molten Core Hound Room”,
“Fire Dog”, {:east => :moltencore})
Start the dungeon by placing the players in the Molten Core
my_dungeon.start(:moltencore)
My RESULT SHOULD BE:
Molten Core
Ragnoras the Firelord
However my actual result is:
ArgumentError: wrong number of arguments (1 for 0)
method initialize in Dungeon.rb at line 5
method new in Dungeon.rb at line 5
method initialize in Dungeon.rb at line 5
method new in Dungeon.rb at line 62
method in Dungeon.rb at line 62
How can I start reading the methods at line 5 and discover a solution?