These are chat archives for pozadi/kefir

9th
May 2015
Petr Myazin
@pqr
May 09 2015 08:46
I've just red an article: writing Sokoban game with Bacon.js: http://habrahabr.ru/post/198656/
my doubts: Bacon is used to make stream of keydown events, then filter/map/filter/map them...
but the game state is global (global js objects) and filter/map functions make read from this global state
for me feels not "functional" approach
may be it's beetter (more FRP way) to manage game state within stream? using .scan?
what do you think?
Petr Myazin
@pqr
May 09 2015 08:52
Actually I want to implement another game with Kefir: "last match game" (rules: http://www.boyscouttrail.com/content/game/last_match-406.asp)
now thinking how to manage the gamestate...
Roman Pominov
@rpominov
May 09 2015 10:02
Yes, I think it should be expressed as gameState = userActions.scan(fn, initialGameState) should be pretty straightforward for Sokoban.
But for more complex games when you have more moving objects, you'll soon find yourself doing a lot of stuff in fn handler.
In this case it might be a right choice to cheat, and to use global mutable state.
@pqr ^
Roman Pominov
@rpominov
May 09 2015 21:21
Any ideas for polishing API for 3.0.0? pozadi/kefir#103