【发布时间】:2020-12-18 03:56:18
【问题描述】:
对于任何从事交互式小说开发和 python 开发的人,我有一个问题:我在设计选择一个用 python 制作的 IF 库时陷入僵局,完成了所有的花里胡哨,开发进展顺利直到我想出一个想法来解决我不得不解决的几个问题并使代码看起来更符合我作为库的基础的 actual 解释器,但是我似乎,我不知道,有点争议。如果你在一个 IF python 库中编码,你愿意为每个对象做这样的事情吗:
main = ObjMap()
@main.room
class my_room(Room):
# ... other important stuff like the name and description
west = "my_other_room"
@main.room
class my_other_room(Room):
east = "my_room"
def some_method(self, args, params):
pass
或类似的东西(我需要地图,以便有一个包含整个游戏的对象):
main = ObjMap()
my_room = Room() # ... important stuff goes in the constructor...
my_other_room = Room()
with my_other_room:
def some_method(self, args, params):
pass
main.create_connection(my_room, "west", my_other_room, "east")
每个都做同样的事情,并且大小接近相同,但我不确定其他 python 编码人员对每种技术的看法。这些是最好的选择,而不仅仅是制作新的编。专用于 IF 的语言。 ahem TADS 如果这是完全错误的地方,请告诉我。谢谢!
【问题讨论】:
标签: python interactive