@@ -64,11 +64,6 @@ class Event:
6464
6565 An event gets triggered when its set of conditions become all statisfied.
6666
67- Attributes:
68- actions: Actions to be performed to trigger this event
69- commands: Human readable version of the actions.
70- condition: :py:class:`textworld.logic.Action` that can only be applied
71- when all conditions are statisfied.
7267 """
7368
7469 def __init__ (self , actions : Iterable [Action ] = (),
@@ -85,18 +80,23 @@ def __init__(self, actions: Iterable[Action] = (),
8580 """
8681 self .actions = actions
8782 self .commands = commands
83+
84+ #: :py:class:`textworld.logic.Action`: Action that can only be applied
85+ #: when all conditions are statisfied.
8886 self .condition = self .set_conditions (conditions )
8987
9088 @property
91- def actions (self ) -> Iterable [Action ]:
89+ def actions (self ) -> Tuple [Action ]:
90+ """ Actions to perform to trigger this event. """
9291 return self ._actions
9392
9493 @actions .setter
9594 def actions (self , actions : Iterable [Action ]) -> None :
9695 self ._actions = tuple (actions )
9796
9897 @property
99- def commands (self ) -> Iterable [str ]:
98+ def commands (self ) -> Tuple [str ]:
99+ """ Human readable version of the actions. """
100100 return self ._commands
101101
102102 @commands .setter
@@ -177,18 +177,6 @@ class Quest:
177177 A quest is defined by a mutually exclusive set of winning events and
178178 a mutually exclusive set of failing events.
179179
180- Attributes:
181- win_events: Mutually exclusive set of winning events. That is,
182- only one such event needs to be triggered in order
183- to complete this quest.
184- fail_events: Mutually exclusive set of failing events. That is,
185- only one such event needs to be triggered in order
186- to fail this quest.
187- reward: Reward given for completing this quest.
188- desc: A text description of the quest.
189- commands: List of text commands leading to this quest completion.
190- optional: Whether this quest is optional or not to finish the game.
191- repeatable: Whether this quest can be completed more than once.
192180 """
193181
194182 def __init__ (self ,
@@ -217,13 +205,18 @@ def __init__(self,
217205 """
218206 self .win_events = tuple (win_events )
219207 self .fail_events = tuple (fail_events )
208+
209+ #: str: A text description of the quest.
220210 self .desc = desc
221211 self .commands = tuple (commands )
212+ #: bool: Whether this quest is optional or not to finish the game.
222213 self .optional = optional
214+ #: bool: Whether this quest can be completed more than once.
223215 self .repeatable = repeatable
224216 if self .repeatable :
225217 assert self .optional # Only optional quest can be repeatable.
226218
219+ #: int: Reward given for completing this quest.
227220 # Unless explicitly provided, reward is set to 1 if there is at least
228221 # one winning events otherwise it is set to 0.
229222 self .reward = int (len (win_events ) > 0 ) if reward is None else reward
@@ -232,15 +225,23 @@ def __init__(self,
232225 raise UnderspecifiedQuestError ()
233226
234227 @property
235- def win_events (self ) -> Iterable [Event ]:
228+ def win_events (self ) -> Tuple [Event ]:
229+ """ Mutually exclusive set of winning events. That is,
230+ only one such event needs to be triggered in order
231+ to complete this quest.
232+ """
236233 return self ._win_events
237234
238235 @win_events .setter
239236 def win_events (self , events : Iterable [Event ]) -> None :
240237 self ._win_events = tuple (events )
241238
242239 @property
243- def fail_events (self ) -> Iterable [Event ]:
240+ def fail_events (self ) -> Tuple [Event ]:
241+ """ Mutually exclusive set of failing events. That is,
242+ only one such event needs to be triggered in order
243+ to fail this quest.
244+ """
244245 return self ._fail_events
245246
246247 @fail_events .setter
@@ -249,6 +250,7 @@ def fail_events(self, events: Iterable[Event]) -> None:
249250
250251 @property
251252 def commands (self ) -> Iterable [str ]:
253+ """ List of text commands leading to this quest completion. """
252254 return self ._commands
253255
254256 @commands .setter
@@ -297,8 +299,8 @@ def deserialize(cls, data: Mapping) -> "Quest":
297299 def serialize (self ) -> Mapping :
298300 """ Serialize this quest.
299301
300- Results :
301- Quest's data serialized to be JSON compatible
302+ Returns :
303+ Quest's data serialized to be JSON compatible.
302304 """
303305 data = {}
304306 data ["desc" ] = self .desc
@@ -370,8 +372,8 @@ def deserialize(cls, data: Mapping) -> "EntityInfo":
370372 def serialize (self ) -> Mapping :
371373 """ Serialize this object.
372374
373- Results :
374- EntityInfo's data serialized to be JSON compatible
375+ Returns :
376+ EntityInfo's data serialized to be JSON compatible.
375377 """
376378 return {slot : getattr (self , slot ) for slot in self .__slots__ }
377379
@@ -1071,11 +1073,6 @@ class GameOptions:
10711073 Number of objects in the game.
10721074 nb_parallel_quests (int):
10731075 Number of parallel quests, i.e. not sharing a common goal.
1074- quest_length (int):
1075- Number of actions that need to be performed to complete the game.
1076- quest_breadth (int):
1077- Number of subquests per independent quest. It controls how nonlinear
1078- a quest can be (1: linear).
10791076 quest_depth (int):
10801077 Number of actions that need to be performed to solve a subquest.
10811078 path (str):
@@ -1086,27 +1083,6 @@ class GameOptions:
10861083 file_ext (str):
10871084 Type of the generated game file. Either .z8 (Z-Machine) or .ulx (Glulx).
10881085 If `path` already has an extension, this is ignored.
1089- seeds (Optional[Union[int, Dict]]):
1090- Seeds for the different generation processes.
1091-
1092- * If `None`, seeds will be sampled from
1093- :py:data:`textworld.g_rng <textworld.utils.g_rng>`.
1094- * If `int`, it acts as a seed for a random generator that will be
1095- used to sample the other seeds.
1096- * If dict, the following keys can be set:
1097-
1098- * `'map'`: control the map generation;
1099- * `'objects'`: control the type of objects and their
1100- location;
1101- * `'quest'`: control the quest generation;
1102- * `'grammar'`: control the text generation.
1103-
1104- For any key missing, a random number gets assigned (sampled
1105- from :py:data:`textworld.g_rng <textworld.utils.g_rng>`).
1106- kb (KnowledgeBase):
1107- The knowledge base containing the logic and the text grammars (see
1108- :py:class:`textworld.generator.KnowledgeBase <textworld.generator.data.KnowledgeBase>`
1109- for more information).
11101086 chaining (ChainingOptions):
11111087 For customizing the quest generation (see
11121088 :py:class:`textworld.generator.ChainingOptions <textworld.generator.chaining.ChainingOptions>`
@@ -1132,6 +1108,7 @@ def __init__(self):
11321108
11331109 @property
11341110 def quest_length (self ) -> int :
1111+ """ Number of actions that need to be performed to complete the game. """
11351112 assert self .chaining .min_length == self .chaining .max_length
11361113 return self .chaining .min_length
11371114
@@ -1143,6 +1120,9 @@ def quest_length(self, value: int) -> None:
11431120
11441121 @property
11451122 def quest_breadth (self ) -> int :
1123+ """ Number of subquests per independent quest. It controls how nonlinear
1124+ a quest can be (1 means linear).
1125+ """
11461126 assert self .chaining .min_breadth == self .chaining .max_breadth
11471127 return self .chaining .min_breadth
11481128
@@ -1153,6 +1133,23 @@ def quest_breadth(self, value: int) -> None:
11531133
11541134 @property
11551135 def seeds (self ):
1136+ """ Seeds for the different generation processes.
1137+
1138+ * If `None`, seeds will be sampled from
1139+ :py:data:`textworld.g_rng <textworld.utils.g_rng>`.
1140+ * If `int`, it acts as a seed for a random generator that will be
1141+ used to sample the other seeds.
1142+ * If dict, the following keys can be set:
1143+
1144+ * `'map'`: control the map generation;
1145+ * `'objects'`: control the type of objects and their
1146+ location;
1147+ * `'quest'`: control the quest generation;
1148+ * `'grammar'`: control the text generation.
1149+
1150+ For any key missing, a random number gets assigned (sampled
1151+ from :py:data:`textworld.g_rng <textworld.utils.g_rng>`).
1152+ """
11561153 if self ._seeds is None :
11571154 self .seeds = {} # Generate seeds from g_rng.
11581155
@@ -1190,6 +1187,10 @@ def rngs(self) -> Dict[str, RandomState]:
11901187
11911188 @property
11921189 def kb (self ) -> KnowledgeBase :
1190+ """ The knowledge base containing the logic and the text grammars (see
1191+ :py:class:`textworld.generator.KnowledgeBase <textworld.generator.data.KnowledgeBase>`
1192+ for more information).
1193+ """
11931194 if self ._kb is None :
11941195 self .kb = KnowledgeBase .load ()
11951196
0 commit comments