Type simple "verb object" sentences. This is a project for looking inside of, not for playing - it's a demo of the list manipulation, so the chatbot itself is pretty stupid... it matches user sentences against a list of templates and outputs a corresponding response, possibly incorporating any words that matched wildcards in the templates. A real program would remember facts,be context and location sensitive, have multiple retorts, and be able to manipulate a/an before nouns etc. It might even use regexps and be able to match variable length phrases. This merely uses "$1" as a wildcard template, and only substitutes whole words in exact matches - it can't substitute words that contain other characters such as "$1's". A file of words tagged by part of speech (ie verb/noun etc) might also be useful in interpreting unknown requests grammatically. These tagged word lists are easy to find online.
I built a LISP/LOGO-style linked list mechanism to use in a chatbot project. It may be useful to folks in its own right. It requires explicit store management by the user rather than implementing a garbage collector (ie you must free your lists when you're finished with them); it grows the array when more space is needed but does not shrink it when lists are freed - it merely adds the freed cells back to a global freelist which is stored within the memory array itself, so no space overhead is needed to manage the freelist. Blocks are supplied to convert strings into lists of words, LOGO-style. The list cells are held in parallel arrays hd and tl (head and tail are the POP2 equivalents of CAR and CDR. I find those names more readable). This could be extended a lot to be fully LOGO or LISP compatible. I just implemented enough for the demo, and it's not especially efficient (for example these are not circular lists and don't have backlinks, so accessing the last items is an expensive operation) I also don't yet implement lists of lists, but that is definitely doable, There's plenty of room in the "tail" part of a cell to encode some extra bits to denote that the head of a cell is a list. (Scratch itself already handles strings versus numbers so lists are the only type that need special handling) Here is some C code I wrote to handle double-ended queues, which could be used as a model for improving this. http://gtoal.com/src/dequeue.c.html