\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provides euro and other symbols
\else % if luatex or xelatex
  \usepackage{unicode-math}
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\usepackage{hyperref}
\hypersetup{
            pdftitle={CSci 658: Software Language Engineering Adventure Game SCV Analysis},
            pdfauthor={H. Conrad Cunningham},
            pdfborder={0 0 0},
            breaklinks=true}
\urlstyle{same}  % don't use monospace font for urls
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0}
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi

% set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother

\usepackage{caption}
\DeclareCaptionLabelFormat{nolabel}{}
\captionsetup{labelformat=nolabel}

\title{CSci 658: Software Language Engineering\\
Adventure Game SCV Analysis}
\author{\textbf{H. Conrad Cunningham}}
\date{\textbf{25 April 2018}}

\begin{document}
\maketitle

{
\setcounter{tocdepth}{4}
\tableofcontents
}
\hypertarget{scope}{%
\subsection{Scope}\label{scope}}

We limit the scope of our adventure game DSL and semantic model as
follows:

\begin{itemize}
\tightlist
\item
  choose-your-own adventure game
\item
  only one level of play
\item
  text-based interface (no graphics)
\item
  process of configuring the world
\item
  probably more restrictions
\end{itemize}

Issue: So far, we have not handled actions and their consequences
sufficiently precisely to specify the commonalities.

My example: Wizard's Adventure Game from \emph{Land of Lisp} that I
reimplemented in Elixir.

\hypertarget{terminology-from-oo-analysis}{%
\subsection{Terminology from OO
Analysis}\label{terminology-from-oo-analysis}}

This is modified some from in-class analysis.

\begin{itemize}
\tightlist
\item
  location
\item
  connection
\item
  item (movable)
\item
  location description
\item
  connection description
\item
  item description
\item
  mapping of items to locations
\item
  player(s)
\item
  player's inventory
\item
  player's location
\item
  state variables?
\item
  actions
\end{itemize}

\hypertarget{toward-commonalities}{%
\subsection{Toward Commonalities}\label{toward-commonalities}}

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
  A world has a finite but unbounded collection of distinct locations (0
  or more).

  Note: I added ``distinct'' and ``unbounded'' parts after class.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    finite or infinite cardinality?
  \item
    bounded above or unbounded?
  \item
    bounded below?
  \item
    0?
  \end{itemize}
\item
  FOR DISCUSSION: The collection of locations in a world cannot change
  after configuration.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    static? dynamic? (i.e.~collection immutable or mutable?)
  \item
    if dynamic, how do we define allowed changes
  \end{itemize}
\item
  Each location has a unique name separate from its description.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    no name? one name? more than one name?
  \item
    name separate? or as part of description?
  \item
    name unique within world?
  \item
    do we need a separate id for locations (e.g.~small integer)?
  \end{itemize}
\item
  FOR DISCUSSION: A location's name cannot change after configuration.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    static? dynamic? (i.e.~immutable or mutable?)
  \item
    if dynamic, how do we define allowed changes
  \end{itemize}
\item
  Each location has a description.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    no description?
  \item
    more than one description?
  \end{itemize}
\item
  FOR DISCUSSION: A location's description cannot change after
  configuration.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    static or dynamic? (i.e.~immutable or mutable?)
  \item
    if dynamic, how do we define allowed changes
  \end{itemize}
\item
  A world has a possible directed connection between any pair of
  locations in the world. The actual connections present are a subset of
  this set.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    allow possible connections to be absent?
  \item
    only between pairs of locations? or connect more than 2 locations?
    connect a location with itself?
  \item
    allow more than 1 connection between pair of locations?
  \item
    directed or undirected connection?
  \item
    finite or infinite? 0 or more? (determined by other choices)
  \end{itemize}

  Note: We are thinking about the world being modeled by some kind of
  graph structure. These issues and those for locations explore the
  nature of that graph.
\item
  FOR DISCUSSION: The collection of connections in a world cannot change
  after configuration.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    static? dynamic? (i.e.~collection immutable or mutable?)
  \item
    if dynamic, how do we define allowed changes
  \end{itemize}
\item
  A connection does not have a separate name.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    no name? one name? more than on name?
  \item
    name unique within world?
  \end{itemize}

  Assumption: Given the above assumes a simple digraph model, a
  connection can be identified by the pair of nodes it connects and its
  direction. Its description can also provide additional
  differentiation.
\item
  Each connection has a description.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    no description?
  \item
    more than one description?
  \end{itemize}
\item
  FOR DISCUSSION: A connection's description cannot change after
  configuration.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    static? dynamic?
  \item
    if dynamic, how do we define allowed changes
  \end{itemize}
\item
  FOR DISCUSSION: A world has a finite but unbounded collection of
  distinct items.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    finite or infinite?
  \item
    bounded above or unbounded?
  \item
    bounded below?
  \item
    0?
  \end{itemize}
\item
  FOR DISCUSSON: The collection of items cannot change after
  configuration.

  Note: I am unsure about the choice here.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    static or dynamic?
  \item
    if dynamic, how do we define allowed changes
  \end{itemize}
\item
  FOR DISCUSSION: Each item instance is atomic.

  Note: I am unsure about the choice here, but probably okay.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    is an item indivisible/atomic?
  \item
    can it be split or combined?
  \end{itemize}
\item
  FOR DISCUSSION: Each item has a unique name. The name cannot change
  after configuration. (Break into 2 statements?)

  Note: I am unsure about the choice here. Perhaps we just want a type
  name like ``bucket'' rather than ``bucket1'' and ``bucket2''. Or maybe
  we need both kinds of names.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    does an item have an individual name? a name of the kind of object
    it is? both? or no name?
  \end{itemize}
\item
  FOR DISCUSSION: Each item has a description. The description cannot
  change after configuration. (Break into 2 statements?)

  Note: I am unsure about the choice here. We may not need this for the
  game.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    does it have a description? how does that differ from name?
  \item
    can description be null?
  \end{itemize}
\item
  FOR DISCUSSION: Each item has a position at any point in time. The
  position may change during the game. (Break into 2 statements?)

  Issues:

  \begin{itemize}
  \tightlist
  \item
    can it be split across multiple positions? or just one? or nowhere
    inside game?
  \item
    can a position change spontaneously? or only under player control?
  \item
    if it can change, what are the allowed changes
  \end{itemize}
\item
  FOR DISCUSSION: A position is any location (name) or a player
  inventory.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    are there other places we need to consider?
  \end{itemize}
\item
  FOR DISCUSSION: The world has a finite but unbounded collection of
  distinct state variables, each of which has a unique name, a set of
  possibly participating items, and a set of possible states.

  The parts about possible participants and possible states may not be
  quite what is needed.

  In the Wizard's game, these are states like the the chain and bucket
  being welded together or the bucket being filled (with water).

  Do we have multiple state variables with the same name but different
  participants?
\item
  FOR DISCUSSION: There is one human player and no similar automated
  players.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    one player? multiple human players? no human players?
  \item
    automated players?
  \item
    Are there non-player characters or agents that can cause some
    changes?
  \end{itemize}
\item
  FOR DISCUSSION: Each player has a unique current location in the
  world.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    at a location?
  \item
    at a connection?
  \item
    in more than one place at once? in no place inside world?
  \end{itemize}
\item
  FOR DISCUSSION: Each player has an inventory of items being held.

  Issues:

  \begin{itemize}
  \tightlist
  \item
    finite or infinite?
  \item
    bounded below or above?
  \item
    can it change spontaneously?
  \end{itemize}
\item
  FOR DISCUSSION: The world has a finite but unbounded collection of
  actions. Each action has a unique name, a subject, an object, a
  transformation of the world, and a result.

  This is too vague and imprecise. Not quite right!

  What about builtins like look, walk, inventory?

  Are these in scope of configuration?
\end{enumerate}

\hypertarget{toward-variabilities}{%
\subsection{Toward Variabilities}\label{toward-variabilities}}

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
  What locations in collection. Each location's name and description.
\item
  What connections in collection. Each connection's source and target
  locations. Each's description.
\item
  What items in collection. Each item's name, description, and current
  position.
\item
  What items are in the player's inventory.
\item
  What state variable in collection. Each's name, list of possible
  participants, and possible states. Each also have a current list of
  participants and current state.
\item
  What are the actions?
\end{enumerate}

\hypertarget{toward-a-possible-semantic-model-python}{%
\subsection{Toward a Possible Semantic Model
(Python)}\label{toward-a-possible-semantic-model-python}}

Underlying model is a digraph with ``labels'' (data) on each node and
each edge. Here I use something like a node adjacency list structure.

\begin{itemize}
\item
  Collection of locations is a mapping from a name to its description.
  (Names are unique within the collection.)
\item
  Collection of connections is a mapping from a source location name to
  a pair consisting of the destination location and the description of
  the connection. (Names are unique within the collection.) (This could
  be two mappings instead of a mapping to a tuple.)
\item
  Collection of items is a mapping from an item name to its description.
  (Names are unique within the collection.)
\item
  Current item positions are given by a mapping from a name to a
  location name, where there is a special reserved name (e.g.
  ``inventory'' but cannot be a valid location name) to denote a
  player's inventory.

  I kept this separate from the previous mapping because the positions
  change but the descriptions do not.

  If more than one player, then inventory idea is probably player name.
\item
  Collection of state variables is a mapping between the state variable
  name and
\end{itemize}

\hypertarget{toward-a-possible-external-dsl}{%
\subsection{Toward a Possible External
DSL}\label{toward-a-possible-external-dsl}}

Here is a rough grammar for a possible external, text-based DSL:

\begin{itemize}
\item
  WORLD -\textgreater{} \{ LOCATION \} \{ CONNECTION \} \{ ITEM \} \{
  STATEVAR \}
\item
  LOCATION -\textgreater{} location LNAME LDESCRIPTION
\item
  CONNECTION -\textgreater{} connection LNAME LNAME CDESCRIPTION
\item
  ITEM -\textgreater{} item INAME IDESCRIPTION IPOSITION
\item
  IPOSITION -\textgreater{} in LNAME \textbar{} inventory
\item
  STATEVAR -\textgreater{} variable VNAME PARTICIPANTS STATES
\item
  PARTICIPANTS -\textgreater{} INAME \textbar{} ( INAME \{ , INAME \} )
\item
  STATES -\textgreater{} ( SNAME \{ , SNAME \} )
\end{itemize}

LDESCRIPTUIN and CDESCRIPTION are probably quoted strings.

LNAME, INAME, VNAME, and SNAME are probably identifier-style strings
that are not keywords. They can probably have separate namespaces for
each kind.

The keywords are location, connection, item, in, and inventory. Open and
closed parentheses and commas are also terminal symbols.

We are not handling ACTIONS here. State variables are probably not
correct.

\hypertarget{toward-a-possible-internal-dsl-python}{%
\subsection{Toward a Possible Internal DSL
(Python)}\label{toward-a-possible-internal-dsl-python}}

For discussion.

\end{document}
