Question: Ruby Colossal Cave: https://en.wikipedia.org/wiki/Colossal_Cave_Adventure For this exercise complete the simple Dungeon game in the Inital Dungeon code. This is a fun way to learn about

Ruby

Ruby Colossal Cave: https://en.wikipedia.org/wiki/Colossal_Cave_Adventure For this exercise complete the simple Dungeon game

Colossal Cave: https://en.wikipedia.org/wiki/Colossal_Cave_Adventure

For this exercise complete the simple Dungeon game in the Inital Dungeon code. This is a fun way to learn about using classes and objects. Youll be learning about a new type of Ruby data structure called the Struct class(p. 139) its a simple was to create a data structure that is sometime preferable to using a class.

Youll notice that the Dungeon game is one large class with several nested classes within it: Player and Room. All of the action takes place inside of the Dungeon class.

There may be several points in putting the dungeon code together that you will have to re-factor the code. Be sure to follow instructions carefully.

Assemble the Dungeon from the code given the Inital Dungeon code into a file named dungeon.rb.

Add at least two more rooms to your dungeon.

Run your code and capture the output into a file named dungeon.txt.

Inital Dungeon code:

class Dungeon
attr_accessor :player
def initialize(player_name)
@player = Player.new(player_name)
@rooms = []
end
class Player
attr_accessor :name, :location
def initialize(player_name)
@name = player_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
end
end

doug@theLinuxPC:lhome/doug/Dropbox/sass master n/Dropbox/sass master adventure Welcome to Adventure Would you like instructions? Somewhere nearby is Colossal Cave, where others have found fortunes in treasure and gold, though it is rumored that some who enter are never seen again. Magic is said to work in the cave I will be your eyes and hands Direct me with commands of 1 or 2 words I should warn you that I look at only the first five letters of each word, so you'll have to enter northeast" as "ne" to distinguish it from "north". (Should you get stuck, type "help" for some general hints For information on how to end your adventure etc., type "info".) This program was originally developed by Will Crowther Most of the features of the current program were added by Don Woods. Address complaints about the UNIX version to Jim Gillogly (jimorand.org). You are standing at the end of a road before a small brick building. Around you is a forest. A small stream flows out of the building and down a gully. Figure 1 Colossal Cave (1976) was a text adventure game that ran on mainframe computers. The Dungeon game we'll build is a very simple version of it

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!