Source

hexbattle / plan.org

Full commit
#+STARTUP: overview
#+TAGS: COMPUTER(c) OLPC(o) WOHNUNG(w) RAUS(r) SONST(s) LESEN(l) JETZT(j) ARNE(a) NICA(v) KANBAN(k) 1w6(1) FAMILIE(f)
#+STARTUP: hidestars
#+SEQ_TODO:  STARTED |  DEFERRED

* Kanban

|                                     | STARTED                              |  |
|--------------------------------------+--------------------------------------+---|
| [[❢ Refactor in such a way that the UiState and (even more importantly) the input do not need to call the model directly anymore.][Refactor in such a way that the]]      |                                      |   |
|                                      | [[❢ let Presentation manage dumb sprites for all chars which are active. Then I can remove a lot of UiState dependent functionality from the chars.][let Presentation manage dumb sprites]] |   |
| [[❢ return all actions on every command: command(...)  commands (instance of Commands).][return all actions on every command:]] |                                      |   |
| [[❢ Make the UiState adhere the list of possible commands.][Make the UiState adhere the list of]]  |                                      |   |
| [[❢ Turn the model into a pure state machine.][Turn the model into a pure state]]     |                                      |   |
#+TBLFM: $1='(kanban-todo @# @2$2..@>$> nil '("/home/arne/Quell/Programme/fungus_eventbased/plan.org"))::@1='(kanban-headers $#)

* refactor Hexbattle                                                    :1w6:
** Structure plan:

*Interaction*
 UiState
 presentation (also needed for the sound later on, so uses its own class)
 input (on_draw functions and such)

*Logic*
 model (scene.update should partly move into this: model.step)
 command (callable functions, see results  possible commands). Never used directly (only via the possible actions)
 results (hexmap, units, actor, possible commands)

Loosely coupled: 

- UiState sends commands to the logic and reads results. 
- Presentation just shows the UiState. 
- Input changes the UiState. It needs the state as attribute.
- command changes the _model and returns the results - including new commands to call.
- results are recreated after every command. Available as logic.results as well as returned by any command (to avoid having to issue empty commands).

**  First all logic from UiState into the model. Model gets all state which is independent of the UI. Any necessary interaction in UiState calls model methods. 
**  Refactor in such a way that the UiState and (even more importantly) the input do not need to call the model directly anymore.
***  let Presentation manage dumb sprites for all chars which are active. Then I can remove a lot of UiState dependent functionality from the chars.
***  return all actions on every command: command(...)  commands (instance of Commands).
**  Make the UiState adhere the list of possible commands.
**  Turn the model into a pure state machine.