#include "histogram.h" #include #include template void histogram::add(const T& inst) { freqtable[inst]++; } template void histogram::compile() { distribution.clear(); int max = 0; for (auto& it : freqtable) { max += it.second; distribution.emplace(max, it.first); } freqtable.clear(); } template const T& histogram::next() const { int max = distribution.rbegin()->first; int r = rand() % max; return distribution.upper_bound(r)->second; } template void histogram::print() const { for (auto& freqpair : freqtable) { std::cout << freqpair.first << ": " << freqpair.second << std::endl; } } template class histogram ; elago/'>lingo2-archipelago
Randomizer for LINGO 2 using Archipelago Multiworld
about summary refs log tree commit diff stats
blob: 2b98178781387b3a54b10ee16b8b8ed246efb460 (plain) (blame)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: "Tree Entrance"
panel_display_name: "Outside Pumpkin"
panels {
  name: "RAT"
  path: "Panels/Hexes/lime_1"
  clue: "rat"
  answer: "rated"
  symbols: SPARKLES
}
panels {
  name: "DIFFERENCE"
  path: "Panels/Hexes/lime_2"
  clue: "difference"
  answer: "some"
  symbols: SUN
  symbols: ZERO
}
panels {
  name: "LEANS"
  path: "Panels/Hexes/lime_3"
  clue: "leans"
  answer: "aliens"
  symbols: SPARKLES
  symbols: ZERO
}
panels {
  name: "QUESTION"
  path: "Panels/Hexes/lime_4"
  clue: "question"
  answer: "what"
  symbols: EXAMPLE
}
panels {
  name: "WHERE"
  path: "Panels/Hexes/lime_5"
  clue: "where"
  answer: "are"
  symbols: SPARKLES
  symbols: AGE
}
panels {
  name: "SUNDER"
  path: "Panels/Hexes/lime_6"
  clue: "sunder"
  answer: "over"
  symbols: SUN
  symbols: SPARKLES
}
ports {
  name: "TREE"
  path: "Components/Warps/Worldports/worldport12"
}