--- layout: ../Site.layout.js --- # Last Five Hours entire Lispgame plant-insect (now just-plant) - «.Index» (to "Index") # Preamble Jumping to the end is more of a summary experience. This is the entire code of my submission to [Lispgamejam2025](https://itch.io/jam/spring-lisp-game-jam-2025/rate/3546880). This was an exploration of possibilities in my knowledge representation. # Amble With some apologies, this emacs eev-mode markdown file using my KRF in gnu clisp is the jam submission! It works on my machine <3. You have no choice but to talk to me personally to learn how to trivially run it on your machine. Inb4 typos. # «Intro» (to ".Intro") I frittered the lispgamejam week away (busy! Deep emacs rerealizations! Live interview!) but it won me some scattered realizations. - `Software-individuals`' entities must specifically and just be entities. - - Not an atom in a sequence of sequences that is an entity - - This seems more obvious in hindsight. The two dimensional sequence is an optimization, and tangling the thing as such with a spatial processing optimization ruins interactions with the former. The optimization can be constructed when it is being used. - `nil` entities (which in my software-individuals is anything currently having the `type` property `nil`) are a useful natural answer to ``` (case (get thing type) (plant (do-plant-things)) (insect (do-insect-things)) (t (do-nothing))) ``` - - allowing that it's funny we are doing a `case` over a type property instead of a `typecase` over a lisp type. - `plant`s and `insect`s can be removed by setting their type to nil. - - The result is that the next time their entityfile is (written, and) `loadk`ed, - - - The immediate next time, the symbol is present but its type is nil - - - Because its type is nil, the next time the `entityfile` is written the entity is not written - - - Starting the second time the `entityfile` is loaded, the `entity` is just gone. - - If nothing was there, nothing happens is a useful default `case` - An `organism`'s belief about where it is is separate data from the ground-it-is-standing-on's belief about where it is - - `t1` of an entityfile of ground tiles can be interpreted as a 2D grid by `row-major-aref` if order is preserved - - the grid wrapping and `nil`s produced by this without explicit handling are more-or-less correct. I cannot say that I am particularly proud of my jam compared to everyone else! However a teacher I had, (Ernie Kalnins) used to tell me, specifically about me, that his view of examinations was that putting a student essentially in a crisis where the class subject was their only hope of survival leads their knowledge to suddenly crystalize in a way that routine daily study does not result in. Cruel/old-fashioned, but the game jam has certainly helped me think things through. And there is still practically five hours left, so let us see what we can do. Forgive the repetitive portions. # «Making the software individual» (to ".Making the software individual") Using emacs eev, though you knew that! ```  (eepitch-shell) cd git clone https://codeberg.org/tfw/pawn-75.git Pawn-75 mkdir -p ~/leocommunity cp -r Pawn-75/Pawn-75 ~/leocommunity/Plant-insect-gamer ``` # «Start the software individual» (to ".Start the software individual") ```  (setq inferior-lisp-program "clisp -E ISO-8859-1 -modern")  (slime)  (setq eepitch-buffer-name "*slime-repl clisp*") (require "asdf") (uiop:chdir "~/leocommunity/Plant-insect-gamer/demus/Process/main/") (load #p"../../../remus/Startup/cl/acleo.leos") (cle) ``` # «Create game knowledgebase» (to ".Create game knowledgebase") ``` crek game-kb loadk game-kb setk game-kb ``` # «create types-and-fun entityfile» (to ".create types-and-fun entityfile") ``` crefil types-and-fun loadk types-and-fun ``` # «type thingtype entities for plant/insect/tile» (to ".type thingtype entities for plant/insect/tile") ``` put organism type thingtype put organism attributes {row col map sensor-range} addmember (get types-and-fun contents) organism put plant type thingtype put plant attributes {row col map sensor-range} put plant subsumed-by {organism} addmember (get types-and-fun contents) plant put insect type thingtype put insect attributes {row col map sensor-range} put insect subsumed-by {organism} addmember (get types-and-fun contents) insect put tile type thingtype put tile attributes {row col contains} addmember (get types-and-fun contents) tile writefil types-and-fun loadk types-and-fun ``` Note that even though plant is `subsumed-by` `organism`, I have individually set `plant` and `organism`s attributes. My current understanding is that `subsumed-by` states a belief that this `type` is thought to also reflect some definitions of the subsuming `type`s in a defeasible sense. WIP # «Add an organism» (to ".Add an organism") ``` crefil organisms loadk organisms put dandelion-01 type plant put dandelion-01 row 1 put dandelion-01 col 2 put dandelion-01 map test-map addmember (get organisms contents) dandelion-01 writefil organisms ``` # «add test-map» (to ".add test-map") In common lisp. ``` crefil test-map loadk test-map . (defparameter *tiles-in* (loop :for idx :below 25 :for (row col) := (multiple-value-list (truncate idx 5)) :collect (intern (format nil "tile-~d-~d" row col)))) . ;; cle uses readline. Sorry about the one-liners. . (loop :for tile :in *tiles-in* :do (setf (get tile 'type) 'tile)) . (setf (get 'test-map 'contents) `(seq& ,(append '(test-map) *tiles-in*))) . (loop :for idx :from 0 :for (row col) := (multiple-value-list (truncate idx 5)) :for tile :in *tiles-in* :do (setf (get tile 'row) row (get tile 'col) col)) writefil test-map ``` ### Aside: At this point, I got kicked out of the library where I was writing this because, as a librarian I had not met told me, someone who looked like me had to go sit with the group of other rough looking men (whom appeared to know each other, and were minding their own business) or leave! Stranger than fiction. At least the librarians to whom I am a daily face looked remorseful (quietly). # add an explicitly typed live-life action ``` put living-life type lispdef addmember (get types-and-fun contents) living-life writefil types-and-fun ``` ## Definition ``` --------------------------------------------------------- -- living-life [: type lispdef] [: latest-rearchived nil] (leodef live-life live-life () (loop :for organism :in (cdadr (get 'organisms 'contents)) :do (case (get organism 'type) (plant (let* ((new-name (gensym "dandelion-")) (prev-row (get organism 'row)) (prev-col (get organism 'col)) (tile (intern (format nil "tile-~d-~d" prev-row prev-col))) (new-row (+ prev-row (1- (random 3)))) (new-col (+ prev-col (1- (random 3)))) (new-tile (intern (format nil "tile-~d-~d" new-row new-col)))) (when (and (get new-tile 'type) (null (get new-tile 'contains))) (setf (get new-tile 'contains) new-name (get new-name 'row) new-row (get new-name 'col) new-col (get new-name 'type) 'plant) (nconc (cadr (get 'organisms 'contents)) `(,new-name)))))))) ``` # «render test-map to text» (to ".render test-map to text") ``` put render type lispdef addmember (get types-and-fun contents) render writefil types-and-fun ``` ## definition. ``` --------------------------------------------------------- -- render [: type lispdef] [: latest-rearchived nil] (leodef do-render do-render () (loop :for tile :in (cadr (get 'test-map 'contents)) :for idx :from 0 :for (row col) := (multiple-value-list (truncate idx 5)) :for thing := (get tile 'contains) :when (zerop col) :do (terpri) :when thing :do (princ "*") :else :do (princ #\") :finally (terpri))) ``` and ``` loadk types-and-fun ``` # «running a few steps» (to ".running a few steps") ``` ses.052) do-render ""*"* ***** **""* *"""" *"""" " ses.053) ``` I guess the stars are dandelions. I ran it a few times. ``` . (loop :repeat 5 :do (live-life)) ``` or something will work. Mnemonically, the double quotes would be grass. # «release briefly» (to ".release briefly") Well, I included none of the intended features- I will add them after the jam. On the other hand, I did write random-walking dandelion propagation on a finite arbitrary game grid, using an entityfile `test-map` of `tile` entities for the game grid and an entityfile `organisms` for just `plant`s. `plant`s are `subsumed-by` `organism`. All the draft writing material was fundamentally useful to me to begin learning how I can represent grid-based games in my `software-individual` knowledge representation framework, and is a move towards more general introductory material for it. The consequences of modelling a game inside the knowledge representation framework will begin to be explored in my post-mortem. Basically sitcalc modeling over real and imaginary game state timepoints. It would be nice to have an old-fashioned way of consuming common game mechanics and using them to reason about unknowns games (a model learning to play games a common research area). The jam submission is just this markdown file indicating the more-or-less concision and literacy of the KRF. # «Index» (to ".Index") - «.Intro» (to "Intro") - «.Making the software individual» (to "Making the software individual") - «.Start the software individual» (to "Start the software individual") - «.Create game knowledgebase» (to "Create game knowledgebase") - «.create types-and-fun entityfile» (to "create types-and-fun entityfile") - «.type thingtype entities for plant/insect/tile» (to "type thingtype entities for plant/insect/tile") - «.Add an organism» (to "Add an organism") - «.add test-map» (to "add test-map") - «.render test-map to text» (to "render test-map to text") - «.running a few steps» (to "running a few steps") - «.release briefly» (to "release briefly")