From 5864b37d0aef129afd35c5fbfbaab1e4fb854582 Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 25 Mar 2020 22:12:46 -0400 Subject: [PATCH] Tetris: place new pieces on mults of 2 #421 --- src/tetris/newpiece.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tetris/newpiece.h b/src/tetris/newpiece.h index 3b3a8e929..d55e41acf 100644 --- a/src/tetris/newpiece.h +++ b/src/tetris/newpiece.h @@ -18,7 +18,7 @@ std::unique_ptr NewPiece() { const size_t cols = strlen(t->texture); int y, x; stdplane_->get_dim(&y, &x); - const int xoff = x / 2 - BOARD_WIDTH + random() % BOARD_WIDTH; + const int xoff = x / 2 - BOARD_WIDTH + 2 * (random() % (BOARD_WIDTH / 2)); std::unique_ptr n = std::make_unique(2, cols, board_top_y_ - 1, xoff, nullptr); if(n){ uint64_t channels = 0;