summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrant Shangreaux <grant@unabridgedsoftware.com>2022-02-04 16:23:54 -0600
committerGrant Shangreaux <grant@unabridgedsoftware.com>2022-02-04 16:23:54 -0600
commitf3bdd72787c88cf3c26bcb528eeb66b8fd7047d2 (patch)
tree7f6fa0570d44aea0f35510b44dfc3036a0cbf493
parentf966c1bc913ce6f99993dbf5262209f603bf8930 (diff)
Clean: restructure outline heading levels
-rw-r--r--mafia.org38
1 files changed, 19 insertions, 19 deletions
diff --git a/mafia.org b/mafia.org
index 67b59b1..67a78cc 100644
--- a/mafia.org
+++ b/mafia.org
@@ -5,7 +5,7 @@ all doing their routines. one of them gets triggered by something and commits
a murder. they will continue to murder any time their pattern is triggered until
the player figures out who they are.
-** Mafia - boiling it down
+* Mafia - boiling it down
the game [[https://en.wikipedia.org/wiki/Wink_murder]["Mafia"]] is a very simplified version of this, and serves as a starting
point to work out a prototype. for fun, i'm just doing this in emacs-lisp.
@@ -49,7 +49,7 @@ or C-c C-c the source block below:
(switch-to-buffer "*Messages*")
#+end_src
-*** dependencies
+** dependencies
i'm going to bring in some dependencies that will make it more like Common
Lisp. [[info:cl#Top][cl-lib]] brings in functions and macros. When you see things prefixed with
@@ -62,7 +62,7 @@ CLOS, the powerful object oriented system from CL.
(require 'eieio)
#+end_src
-** Game State
+* Game State
a game consists of N >= 4 *actors*, one of which is the *killer*. each game will
have a number of *rounds*, at the end of each an actor will /die/. each round
@@ -75,7 +75,7 @@ other actor reveals whether or not they are the killer. (Q: what makes the kille
join the consensus against themself?) If they are the killer, the other actors
win. If there's only 2 players left, the killer wins.
-*** Game class ~mafia~
+** Game class ~mafia~
using EIEIO, lets define a class ~mafia~ to represent the whole game state.
#+name: mafia-class
@@ -98,7 +98,7 @@ Notice the ~:initform~ slot options (instance variables are called slots in
CLOS/EIEIO). By default, ~(make-instance 'mafia)~ would initialize the object
instance with these values. We will work on defining ~mafia-initialize-actors~ next.
-*** Actors
+** Actors
We may as well use an object to represent the actors as well. Each one will have
an *id* and a *status* which will be one of ~'alive 'dead 'killer~. We can actually
@@ -136,7 +136,7 @@ use inheritance here to set apart the killer with its own ~:initform~.
Then the function ~mafia-initial-actors~ will handle initializing N actors
into a list which is the ~:initform~ of the ~mafia~ game instance.
-*** Game Initialization Functions
+** Game Initialization Functions
#+name: initialization-helpers
#+begin_src emacs-lisp :results silent
@@ -151,7 +151,7 @@ into a list which is the ~:initform~ of the ~mafia~ game instance.
actors)))
#+end_src
-*** visualizing initial game state
+** visualizing initial game state
Lets initialize a game with 6 actors and inspect it to see what to expect.
@@ -175,7 +175,7 @@ Lets initialize a game with 6 actors and inspect it to see what to expect.
| mafia-killer | 5 | nil |
| mafia-innocent | 6 | alive |
-** Basic Game Loop
+* Basic Game Loop
The game loop will advance by a single tick where each actor /observes/ the others.
So... we need to define a game loop function, and a method for the actors to
@@ -191,7 +191,7 @@ So... we need to define a game loop function, and a method for the actors to
(message "Game over!"))
#+end_src
-** Top level game functions
+* Top level game functions
Now that i think of it, using functions here would be simpler. Its likely faster,
and is definitely in Common Lisp. Unless we want to dispatch or use method chains,
@@ -212,8 +212,8 @@ there is not reason to define methods a la Ruby.
(cl-remove-if #'mafia-killer-p (slot-value game 'actors)))
#+end_src
-** Actor Behavior
-*** Observation
+* Actor Behavior
+** Observation
:PROPERTIES:
:header-args: :noweb-ref actor-behavior-methods :noweb-sep "\n\n" :results silent
:END:
@@ -318,7 +318,7 @@ If they're being watched, simply have them target a random other actor (?)
(cl-call-next-method killer)))
#+end_src
-*** Selecting a random other actor
+** Selecting a random other actor
#+name: mafia-random-other
#+begin_src emacs-lisp
@@ -341,7 +341,7 @@ If they're being watched, simply have them target a random other actor (?)
#+RESULTS:
: #s(mafia-innocent 5 #s(mafia-innocent 9 #s(mafia-innocent 10 #s(mafia-innocent 2 #s(mafia-innocent 13 #s(mafia-innocent 12 #s(mafia-innocent 7 #4 alive nil 1) alive nil 6) alive nil 4) alive nil 7) alive nil 3) alive nil 10) alive nil 9)
-*** TODO Example Three Actor Play
+** TODO Example Three Actor Play
:PROPERTIES:
:header-args: :noweb-ref example-three-way-setup
:END:
@@ -400,7 +400,7 @@ eye contact with another actor. The other actors may want to maintain
eye contact as long as they feel the actor they are observing is being
watched by someone else. ???
-*** Unfinished Targeting behavior
+** Unfinished Targeting behavior
#+begin_src emacs-lisp
@@ -419,7 +419,7 @@ watched by someone else. ???
(setf target (seq-random-elt other-actors))))
#+end_src
-*** ~mafia-alive-p~ actor predicate
+** ~mafia-alive-p~ actor predicate
:PROPERTIES:
:header-args: :noweb-ref actor-behavior-methods :noweb-sep "\n\n" :results silent
:END:
@@ -430,7 +430,7 @@ watched by someone else. ???
(eql (slot-value actor 'status) 'alive))
#+end_src
-*** Dying Actors
+** Dying Actors
:PROPERTIES:
:header-args: :noweb-ref actor-behavior-methods :noweb-sep "\n\n" :results silent
:END:
@@ -447,12 +447,12 @@ its ~death-countown~, but I'm not quite prepared for that at this moment.
(setf status 'dead)))
#+end_src
-** Emacs "UI"
+* Emacs "UI"
we can use an emacs buffer and all of the ways we have to manipulate text to
display the simulation.
-*** ~mafia-log~
+** ~mafia-log~
For now, we'll just make a log buffer so we can print "debug" messages
to it as the game progresses.
@@ -486,7 +486,7 @@ Let's see...
Ah ok, we can pack up data for a ~format~ string into a list and print whatever.
-*** Inspecting/Manipulating Individual Actors
+** Inspecting/Manipulating Individual Actors
EIEIO has facilites to hook into the Emacs Custom / Widget apis if you add
correct properties to the class definition. For example: