I expect my code so far will hardly impress you, but you can view it here at
http://git.savannah.nongnu.org/cgit/picolisp-nb.git/tree/text-adventure When the game is (mostly) complete I'll probably fork it out to a separate project. On 04/01/2017 04:11 AM, Joh-Tob Schäg wrote: > @Christopher Howard, > > I would be interested in seeing the source code for your text adventure > RPG as i am working on a MOO (MUD (Multi user Dungeon) Object Oriented). > > You may not want to rebalance after every insert. But you can balance a > 'idx by 'balance . You can always benchmark these combinations it your > approach is faster the mailing list would be interested in your results > and the source. > > 2017-04-01 13:56 GMT+02:00 Christopher Howard > <[email protected] <mailto:[email protected]>>: > > Ah, okay. Somehow in my mind I had reversed the meaning of "==" and "=". > > @Joh-Tob: I am writing a text-adventure game, using a balanced binary > tree as the primary data structure for managing game data. I wrote my > own AA Tree implementation (with guidance from Wikipedia). I see the idx > and balance functions in PicoLisp reference, but my concern is I don't > see how you do with those an (efficient) self-balance after single > inserts to an existing tree, nor how to do self-balancing deletes from > an existing tree. > > On 04/01/2017 01:46 AM, Alexander Burger wrote: > > Hi Christopher, > > > >> : (aa-search '(("threshold" (("long-description" "You stand in front of > >> a wooden door, reputed to be the home of one Dr. Theobold. The door has > >> a small keyhole.") NIL NIL 1)) NIL NIL 1) "threshold") > >> -> ("threshold" ... > > > >> However, if I run this command, I get a different result: > >> > >> : (aa-search (rooms) "threshold") > >> ... > > > > > > The problem is the '==' in > > > >> (if (== Key (car (aa-kv Tree))) > > > > > > You pass a transient symbol "threshold", and '==' checks for exactly > this > > symbol. The scope of transient symbols is per file or REPL instance, so > you ran > > the first test probably in the same instance, while "threshold" in the > second > > was a new, different, symbol. > > > > Either use '=' for comparison, or use only internal symbols as keys. > > > > ♪♫ Alex > > > > -- > https://qlfiles.net > -- > UNSUBSCRIBE: mailto:[email protected] > <mailto:[email protected]>?subject=Unsubscribe > > -- https://qlfiles.net -- UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe
