Skip to content

Instantly share code, notes, and snippets.

@agoose77
Created September 1, 2015 20:41
Show Gist options
  • Save agoose77/88c688ea4d27f0abf56d to your computer and use it in GitHub Desktop.
Save agoose77/88c688ea4d27f0abf56d to your computer and use it in GitHub Desktop.
import hive
import dragonfly
def build_some_hive(i, ex, args):
i.total_score = hive.attribute()
i.pull_in_total_score = hive.pull_in(i.total_score)
i.pull_out_total_score = hive.pull_out(i.total_score)
i.divide_by_players = dragonfly.op.Op(mode="pull", operator="div")
hive.connect(i.pull_out_total_score, i.divide_by_players.a)
i.push_out_mean = dragonfly.std.Transistor()
hive.connect(i.divide_by_players.c, i.push_out_mean.input)
ex.total_score_in = hive.antenna(i.pull_in_total_score)
ex.update = hive.entry(i.pull_in_total_score)
ex.in_player_count = hive.antenna(i.divide_by_players.b)
ex.average_score = hive.output(i.push_out_mean.output)
SomeHive = hive.hive("SomeHive", build_some_hive)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment