Elegant command-parsing in an OOP-based text game

前端 未结 5 1396
情话喂你
情话喂你 2021-02-09 01:52

I\'m playing with writing a MUD/text adventure (please don\'t laugh) in Ruby. Can anyone give me any pointers towards an elegant, oop-based solution to parsing input text? <

5条回答
  •  北荒
    北荒 (楼主)
    2021-02-09 02:31

    The Interpreter design pattern is the most object-oriented approach to parsing that I'm aware of, but I'm sure compiler experts will point out algorithms that are more powerful.

提交回复
热议问题