GithubHelp home page GithubHelp logo

copenhagen's Introduction

Copenhagen

— a story that changes depending on how you look at it

Setup

  1. clj -P and npm install

Structure

Copenhagen is an experimental way of telling a certain kind of story. A story where what you know determines not only the future, but also the past.

To facilitate this, the story is represented by a story graph, which is an ordered tree with three layers:

  1. The first layer contains only one node, the root and is where the story's metadata lives.

  2. The second layer represent paragraphs, which are in turn made up of sentences in the third layer.

Each layer has its own activation mechanism, which when triggered dispatches an event carrying data that describes a transformation of the story graph, e.g., a new paragraph is inserted, a sentence has its words changed.

The UI is then a simple view of the story graph.

ℹ️ Word-level indexing may be supported in the future.

Low-level structure

Each story element is a map with the following shape:

#:element{:id         <uuid>
          :type       <element.type>
          :content    <string | hiccup>
          :children   <vector>
          :dispatch   <dispatch-vector>
          :triggered? <boolean>       
          :active?    <boolean>}

where element.type can be any of :element.type/{word | sentence | paragraph | story}. The :children vector contains IDs of other story elements of a lower-level of organisation (e.g. an :element.type/sentence cannot contain :element.type/paragraph children).

An element of type :element.type/word should always have :element/children of nil. However, since word-level indexing isn't available yet, :element.type/sentence must also obey the same rule.

A story graph is then recursively built from these elements.

When an element is triggered, a re-frame event with the dispatch vector :dispatch is fired, which usually applies a transformation to the story graph. Valid transformations are as follows:

  • Inserting a new element
  • Changing an existing element
  • Deleting an element
  • Trigerring another element

Thus, the evolution of the story graph should be fully determined by an initial state plus the history of all events dispatched.

⚠️ The use of re-frame implies the ability to subscribe to elements in the story graph. However, that feature has yet to be implemented.

copenhagen's People

Contributors

zrkrlc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.