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
50
votes
16 answers

Tetris Piece Rotation Algorithm

What are the best algorithms (and explanations) for representing and rotating the pieces of a tetris game? I always find the piece rotation and representation schemes confusing. Most tetris games seem to use a naive "remake the array of blocks" at…
user21826
  • 3,524
  • 5
  • 28
  • 28
12
votes
2 answers

Polynomial time solution for Tetris Puzzle

This is a puzzle based on Tetris. In this puzzle we are given the sequences of next n pieces that are going to fall from top. Our job is to maximize the score before its GameOver. There is no polynomial time algorithm known for the general Tetris…
xashru
  • 3,400
  • 2
  • 17
  • 30
10
votes
2 answers

Genetic algorithm and Tetris

Im creating a Tetris player using genetic algorithms, and facing some issues. I've read a lot of related works, but they don't give me enough details on the GA. The problem is that my agent seems to get stucked very fast...Im using a evaluation…
Fernando
  • 7,785
  • 6
  • 49
  • 81
8
votes
1 answer

How can move terminal cursor in Python?

I'm making Tetris game with Python in Linux, but I can't move terminal cursor to what I want to position How can move cursor position?? in Python
PARK
  • 95
  • 1
  • 1
  • 5
8
votes
3 answers

Fill up a grid/matrix with pre-defined shapes

Nice to see two up votes for the question. I'll re-word my question now to avoid confusion. The question is how to fill up a mxn grid/matrix with random but pre-defined shapes without a hole. Pre-defined shapes have a variable k which is how many…
Tony Xu
  • 3,031
  • 4
  • 32
  • 43
7
votes
2 answers

Tetris: Layout of Classes

I've written a working tetris clone but it has a pretty messy layout. Could I please get feedback on how to restructure my classes to make my coding better. I focuses on making my code as generic as possible, trying to make it more an engine for…
Ash
  • 3,279
  • 4
  • 28
  • 26
7
votes
1 answer

"after" looping indefinitely: never entering mainloop

This is my first post. I started coding when considering a career swap two months ago and am working on a Tetris clone. I've implemented most of the core features, but cannot get the game to refresh continually with an after loop. I'm using Tkinter…
Tim Wilder
  • 1,607
  • 1
  • 18
  • 26
6
votes
1 answer

Miniature Javascript Tetris

I am trying to write a miniature version of Tetris that adheres to the Tetris guidelines as much as possible: http://tetris.wikia.com/wiki/Tetris_Guideline http://tetrisconcept.net/wiki/Tetris_Guideline To be precise I want the complete game to be…
Jacco
  • 370
  • 1
  • 14
6
votes
3 answers

Determining which inputs to weigh in an evolutionary algorithm

I once wrote a Tetris AI that played Tetris quite well. The algorithm I used (described in this paper) is a two-step process. In the first step, the programmer decides to track inputs that are "interesting" to the problem. In Tetris we might be…
Kai
  • 9,444
  • 6
  • 46
  • 61
5
votes
2 answers

Naive Gravity for Tetris game using 2D Array for the playfield

I'm writing a Tetris-clone and I'm prototyping in C#. The final code is supposed to run on an embedded system (using an 8-Bit CPU and very little RAM), so I'm trying to use a naïve algorithm to do line clear. Right now, my playfield is a 2D…
Michael Stum
  • 177,530
  • 117
  • 400
  • 535
5
votes
1 answer

Moving a user control around within another user control

I'm trying to write a tetris clone, and after doing some research I've come across an example that uses small user controls to form the block and a bigger user control that contains the grid. Everything I've written already seems to work just fine…
Frederik
  • 51
  • 2
4
votes
4 answers

Why create a new Object - Java Tetris Tutorial

Im just new to Java and I found this good tutorial for creating a Java Tetris Game. I dont have a mentor or a tutor to help me with this - Ive been looking for one for ages :( so currently im self learning Java and PHP :) Anyways heres the website I…
VisualFire
  • 45
  • 1
  • 6
4
votes
3 answers

How can I generate a list of all Tetrominos?

How can I generate a list of all Tetrominos? Or, more generally, how can I generate a subset of the polyominoes restricted to a number of cells?
Mark
  • 41
  • 3
4
votes
1 answer

Hard-dropping pieces in tetris-like game

I'm building a tetris-like game, where in stead of removing just one line when you've got a full line I remove all the connected pieces. This has got me stumped on the hard-drop after clearing the pieces. See this example for a quick and dirty…
AmITheRWord
  • 1,363
  • 2
  • 14
  • 36
4
votes
1 answer

Tetromino space-filling: need to check if it's possible

I'm writing a program that needs to quickly check whether a contiguous region of space is fillable by tetrominoes (any type, any orientation). My first attempt was to simply check if the number of squares was divisible by 4. However, situations like…
Archagon
  • 2,470
  • 2
  • 25
  • 38
1
2 3
18 19