forked from facebookresearch/ParlAI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworlds.py
More file actions
49 lines (34 loc) · 1.15 KB
/
worlds.py
File metadata and controls
49 lines (34 loc) · 1.15 KB
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
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.core.worlds import World
# ----- Baseline overworld that simply defers to the default world ----- #
class SimpleMessengerOverworld(World):
"""
Passthrough world to spawn task worlds of only one type.
Demos of more advanced overworld functionality exist in the overworld demo
"""
def __init__(self, opt, agent):
self.agent = agent
self.opt = opt
def return_overworld(self):
pass
@staticmethod
def generate_world(opt, agents):
return SimpleMessengerOverworld(opt, agents[0])
def parley(self):
return 'default'
class OnboardWorld(World):
def __init__(self, opt, agent):
self.agent = agent
self.episodeDone = False
@staticmethod
def generate_world(opt, agents):
return OnboardWorld(opt, agents[0])
def parley(self):
self.episodeDone = True
def episode_done(self):
return self.episodeDone
def shutdown(self):
pass