-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathRoom.java
121 lines (100 loc) · 4.17 KB
/
Room.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package com.laboon;
public class Room {
private static int _pseudoRand = 0;
private String _description = null;
private boolean _northExit = false;
private boolean _southExit = false;
private boolean _hasSugar = false;
private boolean _hasCream = false;
private boolean _hasCoffee = false;
public boolean hasItem() {
return _hasSugar || _hasCream || _hasCoffee;
}
public boolean hasSugar() {
return _hasSugar;
}
public boolean hasCream() {
return _hasCream;
}
public boolean hasCoffee() {
return _hasCoffee;
}
public boolean northExit() {
return _northExit;
}
public boolean southExit() {
return _southExit;
}
private String getAdjective() {
String[] adjs = { "Small", "Quaint",
"Shiny", "Magenta", "Funny", "Sad", "Fuchsia", "Beige", "Massive", "Refinanced", "Tight", "Loose",
"Dead", "Smart", "Dumb", "Flat", "Bumpy", "Vivacious",
"Slim", "Bloodthirsty", "Beautiful",
"Flowery", "Purple", "Sandy", "Rough",
"Perfect", "Heroic", "Minimalist", "Shoe-Losing", "Major",
"Wonderful", "Loving", "Fun-Loving",
"High-Level", "Functional","Static", "Dynamic",
"Fast", "Bulletproof", "Late", "Silly",
"Salty", "Sour",
"Chair-Adjusting", "Brave", "Forgetful", "Chair-Sitting", "Mind-Blowing", "Crazy",
"Funny", "Birdlike", "Bird-Brained", "Miniature",
"High-Strung", "Famous", "Light", "Dark", "Feral", "Hairy",
"Leaky", "Criminal", "Sassy", "Frumpy", "Tiny",
"Prehistoric", "Metallic", "Sharp", "Historical", "Fierce", "Loud",
"Lunar", "Bohemian", "Bored", "Suspicious",
"Flirtatious", "Street-Smart", "Forgetful",
"Tooth-Filled", "Ravenous",
"Well-Directed", "Well-Fed", "Well-Maintained", "Deep", "Shallow",
"Victorian", "Formal", "Creamy", "Tangy", "Fresh", "Magical", "Mystical",
"Secret", "Prophetic", "Immortal", "Far-Sighted",
"Short-Sighted", "Latin", "Nepalese", "Medical",
"Straightforward", "Literary", "Critical", "Backward", "Rabid", "Bombastic",
"Smelly", "Wanton", "Confusing", "Cheesy",
"Devious", "Pumpkin Spice", "Submerged", "Muscular",
"Well-Organized", "Smooth", "Delicious", "Creamy", "Dry",
"Independent", "Free", "Cheap", "Diaphonous", "Tired",
"Sultry", "Beguiling", "Long-Lived", "Repetitive",
"Disgusting", "Swampy", "Dirty", "Muddy", "Clean", "Dry", "Wet",
"Clear", "Transparent", "Glorious", "Sacrificial", "Electric", "Mechanical",
"Automatic", "Rapid", "Nervous", "Calm", "Contemplative",
"Cerebral", "Voracious", "Starving", "Full", "Killer", "Wicked", "Rational", "Real",
"Homemade", "Cigar-Chomping", "Sinister", "Doubting",
"Robotic", "Monosyllabic", "Maniacal", "Postmodern", "Prehistoric" };
return adjs[(_pseudoRand++ % adjs.length)];
}
private String getNoun() {
String[] nouns = { "kettle", "sink", "sofa", "plant", "elephant", "bird cage", "record player", "picture of a ghost",
"picture of a dog", "dresser", "book", "pizza", "cake", "pinball game",
"slug", "board game", "energy drink", "jack o' lantern", "fireplace",
"pumpkin spice latte", "copy machine", "bag of money", "stapler",
"bottle", "xylophone", "tablecloth", "air hockey table", "textbook", "dog", "duck", "programmer",
"radish", "clock", "carpet", "rug", "stamp collection"};
return nouns[(_pseudoRand++ % nouns.length)];
}
private String generateDescription() {
String toReturn = "\nYou see a " + getAdjective() + " room.\n"
+ "It has a " + getAdjective() + " " + getNoun() + ".\n";
if (_northExit) {
toReturn += "A " + getAdjective() + " door leads North.\n";
}
if (_southExit) {
toReturn += "A " + getAdjective() + " door leads South.\n";
}
return toReturn;
}
public Room(boolean hasCoffee,
boolean hasCream,
boolean hasSugar,
boolean northExit,
boolean southExit) {
_hasCoffee = hasCoffee;
_hasCream = hasCream;
_hasSugar = hasSugar;
_northExit = northExit;
_southExit = southExit;
_description = generateDescription();
}
public String getDescription() {
return _description;
}
}