aboutsummaryrefslogtreecommitdiffstats
path: root/research/experiments/030-app-lifecycle/items-wide.aup
blob: 6b28477ea310854bcc9c577fa9cf9b80a7af48ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
record Item {
  n = 0
  m = 0
}
state items: list of Item
state more: list of Item
state hits = 0
input seed = message { n: number }
input grow = message { step: number }
input add = message { step: number }
on seed {
  items.append(Item { n: seed.n })
}
on grow {
  for i in items {
    more.append(Item { n: i.n + grow.step })
  }
  for m in more {
    items.append(Item { n: m.n })
  }
  for m in more {
    more.remove(m)
  }
}
on add {
  hits = hits + add.step
}
view count = count(i in items where i.n > 0)
view total = hits