MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / game

Function game

test/life.c:54–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54void game(int w, int h, int i)
55{
56 unsigned univ[h][w];
57 //for_xy univ[y][x] = rand() < RAND_MAX / 10 ? 1 : 0;
58 int acc = 0; // nonrandom generation, for benchmarking
59 for_xy {
60 acc += (x*17) % (y*3 + 1);
61 univ[y][x] = acc & 1;
62 }
63 while (i != 0) {
64 //show(univ, w, h);
65 evolve(univ, w, h);
66 if (i > 0) {
67 i--;
68 nudge(univ, w, h); // keep it interesting for benchmark
69 } else {
70#if !__EMSCRIPTEN__
71 usleep(20000);
72#endif
73 show(univ, w, h);
74 }
75 }
76 show(univ, w, h);
77}
78
79int main(int argc, char **argv)
80{

Callers 1

mainFunction · 0.85

Calls 4

evolveFunction · 0.85
nudgeFunction · 0.85
usleepFunction · 0.85
showFunction · 0.70

Tested by

no test coverage detected