Fork me on GitHub
#code-reviews
<
2016-01-21
>
slester00:01:33

Feeling a bit overwhelmed about how to refactor this: https://github.com/slester/amiss/blob/master/src/amiss/core.clj :[

eggsyntax01:01:45

@slester: you might want to talk about your intentions for refactoring & the problems you've had (I saw your posts on #C053AK3F9, but not everyone in this channel will have...)

eggsyntax01:01:06

(just kibitzing; I probably won't get a chance to take a look)

slester01:01:27

@eggsyntax: fair enough. I'm more or less trying to put these things in their own namespaces to avoid having long words like -knowledge in function names

slester01:01:39

and because I keep confusing myself as to what's going on when I'm trying to iron out bugs

slester01:01:48

it may be worth a rewrite šŸ˜›

jonahbenton02:01:01

@slester: looks like a cool game

jonahbenton15:01:34

hey @slester, took more of a look and have 2 alternative thoughts to offer in the realm of design

jonahbenton15:01:08

1. take a step back from the current implementation and try to model the public and private events of the game with data, as messages. For instance, the first draw could be encoded as { :action :draw :player :player1 :card :princess }. Player1 may then take some action in response to that draw, like showing a card to another player: { :action show :by-player :player1 :to-player :player2 :card :general }. That forces a public or potentially private response by the second player, where a private response can be showing ones hand to another player.

jonahbenton15:01:22

2. try to model the different public and private perspectives of each of the actors in the game separately. For instance, an individual player can be modeled with a go-loop, consuming public events, updating its own internal knowledge and inferences of the state of the deck and of the hands of the other players, and then calculating a response or action in cases where it is the players turn, or a ā€œplanā€ in cases where it is not the players turn. And a ā€œgame masterā€ actor can act as the enforcer of rules, delegator of turns, etc

jonahbenton15:01:28

why do this? Right now actions and events are implemented as functional transformations onto a single big state blob, which is fine but at a certain level can complect cause and effect both in terms of semantics and in terms of implementation, e.g. circular dependencies. The current model also complects uber game-level rules and decisions with individual player strategies and can make it hard conceptually to keep concerns separate, and allow for player-specific strategies.

meow16:01:56

wow - great assessment @jonahbenton - props to you ā¤ļø

meow16:01:37

caring is caring

slester16:01:55

Wow, great ideas @jonahbenton! Thank you!