diff --git a/src/subcmds/arcade/conway.zig b/src/subcmds/arcade/conway.zig index 2fae118..c2e9696 100644 --- a/src/subcmds/arcade/conway.zig +++ b/src/subcmds/arcade/conway.zig @@ -145,6 +145,9 @@ pub fn play(width: u64, height: u64, writer: *std.Io.Writer) !void { try con.writer.print("\x1B[{}A", .{height + 1}); try con.print(); + // keep the timeouts reasonable + timeout = std.math.clamp(timeout, 1, 10000); + // keep the cursor in the game window to prevent the terminal from doing // anything we can't/don't account for cursor_x = std.math.clamp(cursor_x, 1, con.width); @@ -174,7 +177,7 @@ pub fn play(width: u64, height: u64, writer: *std.Io.Writer) !void { for (buf) |c| switch (c) { // we don't wanna worry about case when using + '+', '=' => timeout += 50, - '-' => timeout = std.math.clamp(timeout - 50, 1, 1000), + '-' => timeout -= 50, 'n' => break :run, // next generation 'q' => { running = false;