trizehn

Room

Nov 18th, 2020
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. /**
  2.  * Write a description of class Room here.
  3.  *
  4.  * @author Daffa Tristan Firdaus
  5.  * @version 18 November 2020
  6.  */
  7.  
  8. public class Room
  9. {
  10.     public String description;
  11.     public Room northExit;
  12.     public Room southExit;
  13.     public Room eastExit;
  14.     public Room westExit;
  15.  
  16.     /**
  17.      * Create a room described "description". Initially, it has
  18.      * no exits. "description" is something like "a kitchen" or
  19.      *"an open court yard".
  20.      *
  21.      * @param String description
  22.      */
  23.     public Room(String description)
  24.     {
  25.         this.description = description;
  26.     }
  27.  
  28.     public void setExits(Room north, Room east, Room south, Room west)
  29.     {
  30.         if(north != null)
  31.             northExit = north;
  32.         if(east != null)
  33.             eastExit = east;
  34.         if(south != null)
  35.             southExit = south;
  36.         if(west != null)
  37.             westExit = west;
  38.     }
  39.  
  40.  
  41.     public String getDescription()
  42.     {
  43.         return description;
  44.     }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment