gavmor / Dunmanifestin

A verisimilitude generator.
3 stars 4 forks source link

Allow swatches to recur #12

Closed benchristel closed 5 years ago

benchristel commented 5 years ago

This addresses https://github.com/gavmor/Dunmanifestin/issues/11.

You can specify the "starting population" of recurring characters like this:

|person*10
...

And ask for a recurring character like this:

[person:recur]

So, given input like this:

|root
[name] is [profession.article]
[gossip]

|gossip
[name:recur] likes [name:recur]!

|name*10
[rawName.capitalize]

...

Dunmanifestin generates this output, replete with love triangles:

$ bin/dunmanifestin -n 20
Widsar likes Catgah!
Catgah likes Gelar!
Catgah is a cobbler
Achufik likes Waukaife!
Opwuipe is a hostler
Catgah likes Wasi!
Widsar is a merchant
Suicha is a bartender
Kige is a cobbler
Achufik is a farmer
Ii likes Opwuipe!
Gelar is a mechanic
Waukaife is an innkeeper
Sainsyt is a thief
Sainsyt likes Wasi!
Gelar likes Dethuit!
Xoirax likes Waukaife!
Suicha likes Asichec!
Asichec is a thief
Aekatedw is a merchant

One limitation is that you can't use both :recur and inflections like .capitalize. If inflections are requested, :recur is ignored. Implementing the combination of :recur and inflections correctly would be pretty hard, and for our use case, it's not necessary.

gavmor commented 5 years ago

Good idea.

On Sat, Apr 13, 2019 at 7:59 PM Ben Christel notifications@github.com wrote:

@benchristel commented on this pull request.

In lib/dunmanifestin/phrase.rb https://github.com/gavmor/Dunmanifestin/pull/12#discussion_r275138872:

components.each_with_index do |v, k|

  • inflections_delegated_to_me << v.to_sym if components[k-1] == '#'
  • demanded_inflections << v.to_sym if components[k-1] == '.'
  • case components[k-1]
  • when '#'

Check out phrase_spec.rb.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/gavmor/Dunmanifestin/pull/12#discussion_r275138872, or mute the thread https://github.com/notifications/unsubscribe-auth/AAlBQawrcT_uzs0oqZzCLIFIOVd4jbDkks5vgpmSgaJpZM4cuUdr .

-- Gavin Morgan 42-42-42-WHOA quavmo @ anywhere

benchristel commented 5 years ago

@gavmor here's the genre I'm working on: https://github.com/benchristel/weltschmerz

gavmor commented 5 years ago

Wow, yes, XML is the right format!!! This is so cool, I can't wait to try it while my niece is napping, this afternoon!

— Gavin

On Sat, Apr 13, 2019, 9:16 PM Ben Christel notifications@github.com wrote:

@gavmor https://github.com/gavmor here's the genre I'm working on: https://github.com/benchristel/weltschmerz

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gavmor/Dunmanifestin/pull/12#issuecomment-482918471, or mute the thread https://github.com/notifications/unsubscribe-auth/AAlBQdCwAVahunKg-GpZQpsYZhAHgZSkks5vgquegaJpZM4cuUdr .