Public
Edited
Dec 21, 2022
Fork of Mausefalle
Insert cell
Insert cell
//turn1 = Game().init()
Insert cell
//turn2 = Game(turn1).takeTurn(1)
Insert cell
//turn3 = Game(turn2).takeTurn(1)
Insert cell
gamestate
Insert cell
Inputs.bind(Die({ callback: (d, oldvalue) => {
const newvalue = Game({state:oldvalue}).takeTurn(d[0])
// viewof gamestate.value = Game({state: gamestate}).takeTurn(d[0])
console.log("callback", d, oldvalue, newvalue)

return newvalue
}
}), viewof gamestate)
Insert cell
viewof gamestate = shell()
Insert cell
${gamestate.players.map(d => `- ${d.color} ${d.destination.index}\n`)}

- current player: ${gamestate.currentPlayer}, ${gamestate.players[gamestate.currentPlayer].color}
- roll ${gamestate.roll}
- ${gamestate.state}

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
obj = {
const spec= {}

return {
x: () => spec.state = 5
}
}
Insert cell
obj.x()
Insert cell
function(spec={}) {

const state = spec || {players:[]}

return state
}()
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