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
1
vote
1 answer

What is the problem in the "Tetris" game problem given below?

So basically when I start the program everything looks fine, until I try to move the figure. When I try to move figure left or right ,then I get the following error: "local variable 'j' referenced before assignment". When I try to move the figure…
1
vote
1 answer

Can we assign a value to pointer unsigned char array?

Hello everyone I'm trying to make a Tetris game with C++. I'm looking that tutorial #include #include using namespace std; int nFieldWidth = 12; int nFieldHeight = 18; unsigned char *pField = nullptr; //dynamic memory…
1
vote
1 answer

Can you edit Tetris in Python so that you do not have to repeatedly have to press the arrow keys to move the object?

I am trying to make Tetris in python using pygame but so far I have to keep repeatedly pressing the arrow keys for the pieces to move. I was wondering if you could just keep holding the arrow keys to move the pieces. Here is the link to my code (It…
Akshat
  • 123
  • 10
1
vote
2 answers

1 second gap in javascript using Date.now()

I just can't understand why this code makes 1 second delay. In my view, the result should always be zero because Date.now() will give me the same result - the present. I reviewed closure, and Date.now() function but still have no idea. The code is…
BBiYak
  • 29
  • 5
1
vote
1 answer

To control the input speed in c++ regarding getasynckeystate function

I'm writing a simple tetris program using getasynckeystate function in c++. I want to control my input speed in while loop so that the block doesn't move quickly. Here's my simple pseudo code. while(1) { if(GetAsyncKeyState(0x41) & 0x8000) //when…
ssbin4
  • 11
  • 1
1
vote
0 answers

Change exactly one label background color in JavaFx

I'm trying to create Tetris. I created GridPane and filled width and height with labels using nested for loop, then putted GridPane in to the scene. How can I change certain label background all labels have coordinates. I want to change label…
Jules
  • 85
  • 1
  • 12
1
vote
0 answers

Problem implementing LinkCable in a GameBoy emulator

I added a linkcable emulator to a gameboy emulator: https://github.com/maxbit89/GBEmulator The link cable is implemented in https://github.com/maxbit89/GBEmulator/blob/master/serial2sock.c The main thing is i don't shift SB(0xff01) i just swap it…
maxbit89
  • 748
  • 1
  • 11
  • 31
1
vote
1 answer

Correct use of wait()/notify() for a Tetris game

I’m writing a Tetris-like game for Android and I’m trying to implement the “real-time part”. I have something which seems to work, but I want to be sure that my implementation is correct. What I want is: The shapes are going down at a fixed rate…
Guillaume Brunerie
  • 4,676
  • 3
  • 24
  • 32
1
vote
2 answers

Tetris on Java Script key control problem

I am having a problem when I move my key controls mainly the arrows on the keyboard. If the viewpoint is small enough it also moves the screen up and down because of the vertical side bar and the tetris piece at the same time. And I want the pieces…
Mthao09
  • 21
  • 4
1
vote
0 answers

Moving tetris pieces by pressing keys in matrix

This is my first post, I just started coding with java, and I'd like to try to make tetris on it. My java skill are quite limited, and I was wondering how to make my pieces move while they fall down. This is what i coded so far, I know it's a little…
1
vote
1 answer

Placing sublists to other sublists

I would like to copy one list to another: list1= [[0,0,1,0,0], [0,1,0,0,0], [0,1,0,0,0], [0,1,0,0,0], [0,1,0,0,0]] list2= [[2,2], [2,0], [2,0]] If you look at it, list two looks like a tetris "L". My objective is to copy this "L" part to…
IHav
  • 117
  • 7
1
vote
0 answers

algorithm for tiling 2D array with polyminos

It is different from generating polyminos, but it is NP-hard problem too. I'm given polyminos with size 4, 5, 6, as an array. 'F':{'num':0b011110010,'width':3} #will be mutated to polymino as ((0,1,1),(1,1,0),(0,1,0)) #as…
ILoveG11
  • 69
  • 5
1
vote
2 answers

Tetris clone in Java, out of bounds while moving a piece?

I'm trying to write a tetris clone. My board is a 10x20 array of integers on which 0 means no tile, 1-7 means a tile of specific color. It is constantly translated to graphic interpretation. My shapes are 4x4 arrays of integers. I've just come to a…
sdonchor
  • 82
  • 7
1
vote
0 answers

How to design a line deleting function for Tetris game?

I am trying to build a Tetris game in javaScript and HTML. I ran into problems with my function for removing the full lines. It sort of works, but not every time and not as I expected. I am not a professional programmer, I am learning to code just…
Radek John
  • 105
  • 8
1
vote
1 answer

Responsive Tetris grid using div tags

I am trying to build a Tetris game using javaScript and HTML without any tutorial. My methods are very primitive. I am making my grid using div tags. The problem is that it is not as responsive as I expected. This is one row from my grid: …
Radek John
  • 105
  • 8