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
2
votes
1 answer

AttributeError: 'NoneType' object has no attribute 'push'

I was watching a lecture on YouTube and making Tetris. But I got this error. Traceback (most recent call last): File "C:\Users\gkakc\PycharmProjects\Tetris\main.py", line 90, in draw_grid(pen, grid) File…
2
votes
1 answer

Duplicate rows in Python Pygame Tetris clone

I've been looking at this problem for awhile now and have draw a blank so would appreciate some help. I'm making a simple Tetris clone using Python and Pygame. The problem is that the process of detecting completed rows sometimes adds a cloned row…
cookertron
  • 188
  • 12
2
votes
1 answer

Tetris generating coloured shapes from blocks

I'm making Tetris with Pygame. I have designed the blocks separately (a block in every color) so I need to let the game generate all of the blocks' shapes in all colors. I mean I want it to generate for example a shape composed of 4 red blocks in a…
Salem
  • 257
  • 3
  • 13
2
votes
0 answers

Moving blocks down y axis in pygame tetris clone

Through some trial and error, I have decided to draw each of the four Tetris blocks for each shape as their own sprites on separate surfaces. There is a main pivot block in which the other 3 blocks get their y position. Currently working on…
2
votes
1 answer

Custom tetris block placement algorithm

Well it's not entirely a generic problem, but that's why we're here after all. A bit of background My task is to create a tetris like simulation with an AI playing it. The lines do not disappear when they are completed. The end result should be a…
vajnaivik
  • 25
  • 7
2
votes
1 answer

Eliminate duplicated code in different classes

In two different classes I have the same code as below. This section of code enables me to add an alert screen when the user closes a window. What is the best way to avoid writing the same thing twice? public void addWindowEventHandlers() { …
m4t5k4
  • 55
  • 9
2
votes
0 answers

Find the smallest square with a list of tetrominos

Imagine you have a list of Tetrominos (tetris shapes) that cannot rotate (19 possibilities) and you have to arrange them to make the smallest square. For example, given: A... A... A... A... BB.. .B.. .B.. .... .C.. .C.. CC.. .... The result…
Charlon
  • 363
  • 2
  • 16
2
votes
1 answer

Distinct valid pieces of n blocks for Tetris

This is a question my friend asked me yesterday, which I believe is an interview question he saw. The rule is simple, for n=4, there are 5 distinct pieces: ooo o o ooo oo oo oooo oo oo For a given n, you need to calculate the number of…
laike9m
  • 18,344
  • 20
  • 107
  • 140
2
votes
1 answer

Tetris block in C

I have a project for college to create tetris using dynamically allocated board that is representing the empty part with . . I wanted to create the blocks with each of their pieces individually for example the O O O O block in Tetris would be…
ggkhs
  • 21
  • 1
  • 2
2
votes
1 answer

Draw new tetrominos in JavaScript tetris

I'm trying to draw tetrominos in JavaScript and I'm having some trouble. I think the code I have, this.blocks = i.blocks[b][c], is incorrect, but it may be more. Now that my eyes have started hurting, I've decided to ask for help. Does this.blocks =…
aveevu
  • 767
  • 6
  • 15
2
votes
1 answer

How to create automated Tetris bot in Python?

So I've written a tetris bot in python, and it uses the pygame events to respond to keyboard input. Now I'm trying to create an AI to play this game. So I want to basically determine what the best move is, given a piece, and a board. I want to…
Nezo
  • 567
  • 4
  • 18
2
votes
1 answer

Dynamic Object Layout

I have an array of 50 objects, each width a different width and height. My objective is to create panels to hold this objects and keep them in order, but this panel cannot exceed a width of 300 pixels or a height of 600 pixels, so I have to fit as…
lomas09
  • 1,114
  • 4
  • 12
  • 28
2
votes
2 answers

My pygame tetris game keeps getting stuck

I am a beginner python programmer and I am trying to make a tetris game. When I run the game, the block moves down 10 pixels every second. The problem is that randomly the block just stops, the print statements I have also stop printing. I'm not…
2
votes
3 answers

C# Tetris game slow performance

I'm programming a tetris clone for my C# school project. I am using Microsoft Visual Studio 2012. The game itself is implemented as a two dimensional array of blocks(List of Lists of blocks) and every block has its own texture (bmp image). I am…
Dreamer
  • 23
  • 4
2
votes
1 answer

Java Tetris - Using transpose to rotate a piece

I'm building Tetris in Java as a fun side project and am now working on rotations. I was originally hard coding each rotation which was proving to be quite tedious. That being said, I was then going to try Matrix Rotations using linear algebra, but…
user3871
  • 12,432
  • 33
  • 128
  • 268
1 2
3
18 19