Let's learn dialog: Finite Switchable Game

Continuing on from the exercise started earlier, here’s another prompt:

Create a micro game (10~20 moves to the ending) where a switchable item can only be switched on a limited number of times.

For example, a candle could be (switchable $) and (item $), and a global variable or a tick counter can track how many turns the candle has been on or how many times it’s been switched on, and a (prevent [switch on #candle]) can check the count. But I’m sure there are way more creative things that can be done. See what you can come up with!

Here’s the idea I implemented:

1 Like

There is some disambiguation issues between matches and lantern objects.

Thanks for giving it a try! I was conflicted about what to do about the matches.

I wanted to avoid modeling them as a separate item, because I wanted to keep it short and simple.

With this small change I try to make it more clear the matches aren’t an item separate from the lantern while still allowing stuff like “light lantern with match”:

Source Code
(before $)
    (last command was $Words)
    ($Words contains one of [match matches])
    ~($Words contains one of [switch light])
    (par) The matches can't be handled apart from the lantern.
    (stop)

(grammar [light [object]] for [switch on $])
(grammar [blow out [object]] for [switch off $])

(grammar [light [object] with [match/matches]] for [switch on $])
(grammar [switch on [object] with [match/matches]] for [switch on $])
(grammar [switch [object] on with [match/matches]] for [switch on $])
Sample Transcript
Forbidden? That's where they built their cottage? Next to a forest that is
forbidden?

Mallorca, or Malta, or Masca, or... here. You picked here. A EUR 250 per night
deal had something to do with it.

[PRESS ANY KEY] 

Candle Lantern
a finite light source game by tzbits.
Release 1. Serial number DEBUG.
Dialog Interactive Debugger (dgdebug) version 0m/03. Library version 0.46.

Cottage
A cozy cottage with a table in the center.

Cozy despite the Scandi-style furnishings. They should have leaned more Scandi-
Boho, or maybe New Nordic would have been better, or maybe... oh stop it.

> x table
x table
A spartan table. Spartan is good. No, it's too spartan.

There is a lantern here.

> x lantern
x lantern
A nearly spent candle in a lantern box. The small drawer under the candle has 3
matches in it.

> take matches
take matches

The matches can't be handled apart from the lantern.

> light matches
light matches

You strike a match and light the candle wick.

> x match
x match

The matches can't be handled apart from the lantern.

> x matches
x matches

The matches can't be handled apart from the lantern.

> x lantern
x lantern
A flickering, nearly spent candle in a lantern box. The small drawer under the
candle has 2 matches in it.

> 

Anyone want to try writing a short creative dialog program with a “finite switchable”?

Actually, with a “finite switchable” it could also be the case that you can’t turn something off after a certain condition. (Ever notice that many phones are now difficult to turn off?)