Questions tagged [tetris]

Block matching game created by Alexey Pajitnov . Elements are 4-segmented pieces where the name of the game comes (tetra is numerical prefix in Greek used for 4).

Tiles are 4-segmented pieces which also provided the name of the game (tetra the Greek numerical prefix for the number 4). More on Wikipedia

285 questions
4
votes
2 answers

Fill entire 2D Array (Tetris board) with Tetris pieces, no spaces left over (Java)

Let's say I have a 2D int array.. int[][] board = new int[10][20]; public void initBoard() { for(int r = 0; r < 10; r++) for(int c = 0; c < 20; c++) board[r][c] = 0; } 0 means no piece The pieces are represented by 1-7; 1 -…
4
votes
5 answers

Rotating cordinates around pivot? (tetris)

I'm attempting to design my very own tetris clone but have run into a little problem with shape rotations. I have a 2 dimensional array representing a 10 x 20 game grid and individual shape objects which when initialised contain coordinates of…
101010110101
  • 1,940
  • 8
  • 31
  • 42
3
votes
1 answer

Can't spot the bug in my Java Tetris game

My friend and I have made a tetris-like game in Java and it works fine for a while and then suddenly bugs out at around the same number of total pieces every time. For example, it might bug out at 42 pieces one time, 46 the next, and 44 the time…
Bandit
  • 143
  • 5
3
votes
4 answers

Tetris Timing Problem

I am writing a Tetris program with PyGame, and came across a funny problem. Before I ask the question, here is the pseudo-code: while True: # In this part, the human controls the block to go left, right, or speed down if a key is pressed and…
John
  • 143
  • 2
  • 7
3
votes
4 answers

Java Tetris rotation

I know this has been asked a lot but I'd like to know how to rotate a Tetris piece? I already made a long and bad solution (~170 lines of code) but there should be easier way to do it. My tetris pieces consist of 4 blocks which all know their…
Kenny Roberts
  • 31
  • 1
  • 3
3
votes
1 answer

Implementation of p5.js tetris has a bug that makes pieces fall through the bottom

I'm making 3D tetris in p5.js. But right now I have a bug that makes the pieces fall through the bottom! I'm not sure why that is because i wrote a function, "fallingPieceIsLegal" that should prevent this. Thanks so much for your help! //Audrey…
3
votes
1 answer

What do the operators "<>" mean in Python?

I'm trying to understand another author's code for writing a Parser in the "NAND to Tetris" project but don't understand what they mean when using the "<>" operators as shown in this chunk of code. I have included their constructor for reference to…
Cora Coleman
  • 237
  • 1
  • 5
  • 14
3
votes
4 answers

How would I go about displaying my bucket for Tetris in C++?

I have been a programming student for about a year now and I have been tasked with creating a Tetris game. I am trying to display the bucket that is used for the game, it must be 25 x 12. I tried thinking and researching a way to do this using…
3
votes
0 answers

Using java.awt.Robot in a multithreaded environment

I'm working on a (virtual) competitive automated tetris player. Since the game is, well, competitive, I would naturally like my tetris player to press as many keys as possible at the same time. The solution I have come up with is to devote a thread…
Georges Oates Larsen
  • 6,812
  • 12
  • 51
  • 67
3
votes
1 answer

CLI/C++ Tetris block crashes when check if cell is occupied is empty MSVisualStudio 2008

Here is my code for checking if future move is legal, I have assumed its legal and copied move into mySquares array. I then call this method in the game cycle set in the form and in the timer handler which is: canvas->drawGrid(); …
Nolan Ratu
  • 31
  • 3
3
votes
1 answer

Tetris clear lines issue

I am making a tetris clone for a project. I'm pretty much done but my clear lines class has a bug that I cant shake. I have made a 10*20 grid which I draw the sprites into. When I get a line at the floor it works fine but above that it just deletes…
2
votes
2 answers

Trying to create tetris, but can't

For some reason my code refuses to let me assign an x and y position to each block. Each block is 30 pixels wide and tall and will be colored according to which piece it is a part of. Gravity and a clear function haven't been implemented and the…
Tom Prats
  • 7,364
  • 9
  • 47
  • 77
2
votes
1 answer

What is the preferred machine learning technique for building a real-time game player simulator?

I've set out to build an AI-engine that learns to play Tetris, i.e. an engine that can improve it's performance, perhaps by adjusting its heuristics, and so forth. Let's say that I've got the GUI out of the way--where would I begin in building the…
arkate
  • 501
  • 8
  • 23
2
votes
0 answers

Check if tetris piece can reach a specific position

The question is pretty forward: given a slot in a tetris board, how can I check if it is possible for any tetris piece to reach this slot? The pieces are allowed to rotate just like in normal tetris. In this following example, the red piece is…
Daniel
  • 7,357
  • 7
  • 32
  • 84
2
votes
1 answer

Phaser 3 Tetris clone, but the blocks won't land

I'm making a game that involves Tetris, but I'm having trouble with getting the blocks to land. For some reason, the blocks are stopping just short of the long, clear sprite that I'm using as the ground. The Code I'm using is as follows: In the…
EmptyStone
  • 235
  • 1
  • 7
1
2
3
18 19