mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
Tetris: PieceStuck() learns of lower halves
This commit is contained in:
parent
25dd65a172
commit
d5e0b24f01
@ -18,7 +18,7 @@ std::unique_ptr<ncpp::Plane> NewPiece() {
|
|||||||
const size_t cols = strlen(t->texture);
|
const size_t cols = strlen(t->texture);
|
||||||
int y, x;
|
int y, x;
|
||||||
stdplane_->get_dim(&y, &x);
|
stdplane_->get_dim(&y, &x);
|
||||||
const int xoff = x / 2 - BOARD_WIDTH + (random() % BOARD_WIDTH - 1);
|
const int xoff = x / 2 - BOARD_WIDTH + random() % BOARD_WIDTH;
|
||||||
std::unique_ptr<ncpp::Plane> n = std::make_unique<ncpp::Plane>(2, cols, board_top_y_ - 1, xoff, nullptr);
|
std::unique_ptr<ncpp::Plane> n = std::make_unique<ncpp::Plane>(2, cols, board_top_y_ - 1, xoff, nullptr);
|
||||||
if(n){
|
if(n){
|
||||||
uint64_t channels = 0;
|
uint64_t channels = 0;
|
||||||
|
@ -12,8 +12,12 @@ bool PieceStuck() {
|
|||||||
if(board_->get_at(cmpy, cmpx, &c) < 0){
|
if(board_->get_at(cmpy, cmpx, &c) < 0){
|
||||||
throw TetrisNotcursesErr("get_at()");
|
throw TetrisNotcursesErr("get_at()");
|
||||||
}
|
}
|
||||||
if(c.get().gcluster && c.get().gcluster != ' '){
|
if(c.get().gcluster){
|
||||||
return true;
|
if(c.get().gcluster != ' '){
|
||||||
|
if(strcmp(board_->get_extended_gcluster(c), "▄")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user