Author Topic: Said strings & the Use of Articles  (Read 3453 times)

0 Members and 1 Guest are viewing this topic.

Offline gumby

Said strings & the Use of Articles
« on: December 27, 2010, 10:41:34 PM »
It is wise to take into account articles when creating said strings.  Consider all the different ways that a user could might communicate the command 'give the pig the mirror' to the parser.

Code: [Select]
    // Matches: 'give pig mirror' & 'give the pig mirror'
    // Ignores: 'give pig the mirror'
       Print("Output A")

    // Matches: 'give pig the mirror' & 'give the pig the mirror'
    // Ignores: 'give pig mirror' & 'give the pig mirror'
       Print("Output B")

    // Combining the 2 gives you a wider input range
    // Matches all inputs specified above...
    (if(Said('give/pig<mirror') or Said('give/pig/mirror'))
       Print("Output C")

As you can see, the first 2 code blocks behave quite differently when the 'the' article is specified, however the 3rd covers all the test cases.

In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.097 seconds with 23 queries.