Published
Edited
Jul 6, 2020
2 forks
1 star
Insert cell
titleMd = md`# The Computational Boundary of a “Self”, an explorable explanation

Article https://www.frontiersin.org/articles/10.3389/fpsyg.2019.02688/full`
Insert cell
md`## Parameters`
Insert cell
md`### Defining the size of a square environment`
Insert cell
SpotsPerEnvironmentalGridSide = 10
Insert cell
md`### Generating an environment without any resource`
Insert cell
EnviromentalStateBase = new Array(SpotsPerEnvironmentalGridSide*SpotsPerEnvironmentalGridSide).fill(0);
Insert cell
md`### Probably for a spot in the environment to have exploitable resource`
Insert cell
viewof ratioOfFilledResources = html`<input type="range" min="0" max="1" value="0.3" step="0.05">`
Insert cell
ratioOfFilledResources
Insert cell
md`### Probably for spot in the environment to have an element`
Insert cell
viewof ratioOfFilledElements = html`<input type="range" min="0" max="1" value="0.5" step="0.05">`
Insert cell
ratioOfFilledElements
Insert cell
md`### Maximum amount of resource an element can exploit (per tick)`
Insert cell
viewof maxConsumption = html`<input type="range" min="0" max="1" value="0.02" step="0.01">`
Insert cell
ratioConsumptionFromEnvironment = maxConsumption / 0.5
Insert cell
radiusOfCommunication = 1;
Insert cell
md`## Defining environment and elements`
Insert cell
md`### Adding exploitable resources in the environment`
Insert cell
// Initialise State
EnviromentalState = EnviromentalStateBase.map( i => Math.random() < ratioOfFilledResources ? Math.random()*1 : 0)
Insert cell
md`### Adding elements in the environment`
Insert cell
ElementsState = EnviromentalStateBase.map( i => Math.random() < ratioOfFilledElements ? Math.random() : 0)
Insert cell
maxEnergyStored = 1
Insert cell
thresholdToGive = 0.7
Insert cell
viewof energyToGiveAtCommunication = html`<input type="range" min="0" max="1" value="0.01" step="0.001">`
Insert cell
energyToLostAtEachStep = 0.01
Insert cell
md`### Behavior of the element in its environment (called once per tick)`
Insert cell
updateElement = function(e,i) {
// life spending
e = Math.max(0, e - energyToLostAtEachStep);
if (!e) { ElementsState[i] = e; return }
// Consuming resources (non depleating environement)
if(EnviromentalState[i]*255 > 1 && e+ratioConsumptionFromEnvironment<maxEnergyStored) {
e += Math.min( maxConsumption, EnviromentalState[i]*ratioConsumptionFromEnvironment );
}
// messages are energy
let eltJ = Math.floor(i / SpotsPerEnvironmentalGridSide);
let eltI = i % SpotsPerEnvironmentalGridSide;
for(let ix = -radiusOfCommunication; ix <= radiusOfCommunication; ++ix) {
for(let jy = -radiusOfCommunication; jy <= radiusOfCommunication; ++jy) {
if(!ix && !jy) break;
if(ElementsState[((eltJ+jy)*SpotsPerEnvironmentalGridSide) + (eltI+ix)] > thresholdToGive) {
// ElementsState[((eltJ+jy)*SpotsPerEnvironmentalGridSide) + (eltI+ix)] = 0
// used for test, works
}
}
}
// Communications could be modelised through mailbox
// in this case directly giving or taking messages (here energy) is similar and quicker to implement
ElementsState[i] = e;
}
Insert cell
md`Trying to modify the canvas to be a side overlay for faster testing.

(but failing because ... iframe?!)`
Insert cell
html`<style>#defaultCanvas0DISABLED {position:absolute;top:-100px;}</style>`
Insert cell
md`## Display of the environment with elements according to the defined parameters`
Insert cell
canvas = p5(s => {
s.setup = () => {
s.createCanvas(800,400);
}
s.draw = () => {
var spotSize = s.height/SpotsPerEnvironmentalGridSide
// A]UPDATE
// 1) Update the elements
ElementsState.map( (e,i) => {
updateElement(e,i);
})
// 2) check if mouse is hovering over an element
let eltHover = s.createVector(-100,-100);
if(ElementsState[Math.floor( s.mouseY / spotSize ) * SpotsPerEnvironmentalGridSide
+ Math.floor( s.mouseX / spotSize )] > 0) {
eltHover = s.createVector(0.5 *spotSize + spotSize * Math.floor( s.mouseX / spotSize ),
0.5 *spotSize + spotSize * Math.floor( s.mouseY / spotSize ));
}
// B] DRAW
s.background(240)
// 1) Line Grid
s.noFill()
s.stroke(0)
for(var i=0; i<SpotsPerEnvironmentalGridSide+1; ++i) {
s.line(0, i*s.height/SpotsPerEnvironmentalGridSide, s.height, i*s.height/SpotsPerEnvironmentalGridSide);
s.line(i*s.height/SpotsPerEnvironmentalGridSide, 0, i*s.height/SpotsPerEnvironmentalGridSide, s.height);
}
// 2) Draw environement
EnviromentalState.map( (e,i) => {
let x = i % SpotsPerEnvironmentalGridSide * spotSize
let y = Math.floor( i / SpotsPerEnvironmentalGridSide ) * spotSize
s.noStroke()
s.fill(e*255)
s.rect(x,y,spotSize,spotSize)
})
// 3) Draw elements
ElementsState.map( (e,i) => {
let x = i % SpotsPerEnvironmentalGridSide * spotSize
let y = Math.floor( i / SpotsPerEnvironmentalGridSide ) * spotSize
s.stroke(0,0,100)
s.fill(e*255, 0, 0)
if(e) {
s.ellipse(x + spotSize*0.5, y + spotSize*0.5, spotSize*0.75, spotSize*0.75)
}
})
// 4) Draw communication radius of element
s.noStroke()
s.fill(0, 0, 200, 80);
s.ellipse(eltHover.x, eltHover.y, spotSize*1.1,spotSize*1.1)
}
})
Insert cell
visualsMd = md`# Visuals from the paper`
Insert cell
md`![alt text](https://www.frontiersin.org/files/Articles/493866/fpsyg-10-02688-HTML/image_m/fpsyg-10-02688-g004.jpg)`
Insert cell
md`![alt text](https://www.frontiersin.org/files/Articles/493866/fpsyg-10-02688-HTML/image_m/fpsyg-10-02688-g002.jpg)`
Insert cell
md`![alt text](https://www.frontiersin.org/files/Articles/493866/fpsyg-10-02688-HTML/image_m/fpsyg-10-02688-g001.jpg)`
Insert cell
md`## To do

1. ~~setup p5js~~
1. ~~generate visual grid~~
1. ~~black lines~~
1. ~~colored cells~~
1. ~~noisy grid based on 1 color~~
1. define 1 cell
1. must clarify the homeostatic aspect
1. e.g. could have a maximum consumption
1. display the cognitive light cone diagram, in time and space, of each element
1. interaction to add cell(s)
1. update/delete cell(s)
1. define behavior of a cell
1. related to the environment (grid)
1. related to other cells
1. communication probability
1. map visual differentiation per grid e.g.
1. grid 1 = color as analogy for cells
1. grid 2 = shape as analogy for bactery
1. etc clarify the link between grid N-1 / grid N / grid N+1
1. clarify abstraction across grids shwocasing the importance of
1. homeostatis
1. cognition
1. collaboration
1. consider how it can be integrated
1. e.g. viewof with slider
1. cf past work https://glitch.com/edit/#!/experiences?path=README.md testable https://experiences.glitch.me/configurator.html explained in video https://peertube.video/videos/watch/181e20bd-e9b1-4a05-867d-d54b84734191
`
Insert cell
md`# Imports`
Insert cell
import {p5} from '@makio135/p5'
Insert cell
md`# Lessons learned pair prog

## Session June 26
- insure that not too much time is spend on tool discovery
- take time for external communication e.g. Twitter
- refactoring code for next session
- refactor cells in Observable

## Session July 3
- nearly no time wasted on the tools
- better balance on goal vs implementation
- could write down goals
- have a separate prior 30min session on decided what will be communicated

## Chat July 6
- quotes from the paper
- behavior
- video animation
- call for action prompting an exploration with a specific concept to learn about
- e.g. what is homeostatis
`
Insert cell
md`# Related references
- [The Case Against Reality, Why Evolution Hid the Truth from Our Eyes by Donald Hoffman](https://wwnorton.com/books/9780393254693)
- could be interesting on the perception aspect of each element
- [Controllability of complex networks](https://www.nature.com/articles/nature10011)
- Metzinger on self-models
- kappa https://kappalanguage.org
`
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more