MCPcopy Create free account
hub / github.com/android/ndk-samples / GenMedium

Method GenMedium

endless-tunnel/app/src/main/cpp/obstacle_generator.cpp:98–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98void ObstacleGenerator::GenMedium(Obstacle* result) {
99 int n = Random(3);
100 int i;
101 switch (n) {
102 case 0:
103 i = Random(1, OBS_GRID_SIZE - 1); // i is the row of the bonus
104 FillRow(result, i + 1);
105 FillRow(result, i - 1);
106 break;
107 case 1:
108 i = Random(1, OBS_GRID_SIZE - 1); // i is the column of the bonus
109 FillCol(result, i - 1);
110 FillCol(result, i + 1);
111 break;
112 default:
113 i = Random(1, OBS_GRID_SIZE - 1); // i is the column of the bonus
114 FillRow(result, i);
115 FillCol(result, i);
116 break;
117 }
118}
119
120void ObstacleGenerator::GenIntermediate(Obstacle* result) {
121 int n = Random(3);

Callers

nothing calls this directly

Calls 1

RandomFunction · 0.85

Tested by

no test coverage detected