예제 #1
0
  public PlayerTest() {

    // create a player
    p = new Player();

    // create some rooms
    r1 = new Room();
    r2 = new Room();
    r3 = new Room();
    r4 = new Room();

    // add descriptions for the rooms
    r1.setEntryMessage("You are in r1.");
    r2.setEntryMessage("You are in r2.");
    r3.setEntryMessage("You are in r3.");
    r4.setEntryMessage("You are in r4.");

    // connect the rooms in a square shape
    r1.setSide(1, r2);
    r1.setSide(2, r4);
    r2.setSide(2, r3);
    r2.setSide(4, r1);
    r3.setSide(3, r2);
    r3.setSide(4, r4);
    r4.setSide(1, r3);
    r4.setSide(3, r1);

    key = new Item();
    goldbar = new Item();
  }