Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.
C calculatorcalculator-gamescasiochesscrossy-roaddrive-madfx-cg50gamesgeometry-dashgraphing-calculatorndlessnumworksnumworks-appsnumworks-calculatornumworks-gamenumworks-gamestetristi-84-plus-ceti-nspire
NumBlocks generator: no integer overflow for tunnels that carve nothing
Mason Cheneff79d50eea5
diff --git a/games/numblocks/src/gen.c b/games/numblocks/src/gen.cindex 97a04d1e..8cbe0b69 100644--- a/games/numblocks/src/gen.c+++ b/games/numblocks/src/gen.c@@ -2947,6 +2947,7 @@ static int ncrec, crec_ok, crec_ax = 1 << 30, crec_az;static int64_t crec_seed;static void crec_add(int j1, int k1, int pass, int ord) {+ if (rb_x0 > rb_x1) return; /* nothing carved (and its INT32_MAX box would overflow below) */int ox = crec_ax * 16, oz = crec_az * 16, n = CA_SIZE * 16 - 1;int x0 = rb_x0 - ox, x1 = rb_x1 - ox, z0 = rb_z0 - oz, z1 = rb_z1 - oz;if (x1 < 0 || x0 > n || z1 < 0 || z0 > n || rb_y1 < 0 || rb_y0 > 255) return; /* never came near */