document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /**
  2.  * Class Room - sebuah room dalam game kita.
  3.  * Mewakili satu lokasi dalam pemandangan dari game dan terhubung ke
  4.  * kamar lain melalui pintu keluar.
  5.  * Pintu keluar diberi nama north, east, south, west.  
  6.  * Untuk setiap arah, room tersebut menyimpan referensi
  7.  * ke room yang bersebelahan, atau null ika tidak ada jalan keluar.
  8.  *
  9.  * @author  Johnivan Aldo Sudiono
  10.  * @version 16 November 2020
  11.  */
  12. public class Room
  13. {
  14.     public String description;
  15.     public Room northExit;
  16.     public Room southExit;
  17.     public Room eastExit;
  18.     public Room westExit;
  19.  
  20.     /**
  21.      * membuat room dengan deskripsi "description".
  22.      * Awalnya, tidak ada pintu keluar/
  23.      *
  24.      * @param description Deskripsi room.
  25.      */
  26.     public Room(String description)
  27.     {
  28.         this.description = description;
  29.     }
  30.  
  31.     /**
  32.      * Menentukan pintu keluar room ini. Setiap arah mengarah ke
  33.      * ruangan lain atau null (tidak ada jalan keluar di sana).
  34.      */
  35.     public void setExits(Room north, Room east, Room south, Room west)
  36.     {
  37.         if(north != null)
  38.             northExit = north;
  39.         if(east != null)
  40.             eastExit = east;
  41.         if(south != null)
  42.             southExit = south;
  43.         if(west != null)
  44.             westExit = west;
  45.     }
  46.  
  47.     /**
  48.      * @return deskripsi room.
  49.      */
  50.     public String getDescription()
  51.     {
  52.         return description;
  53.     }
  54.  
  55. }
');