Supported cryptocurrencies:
BTC BTC
BCH Bitcoin Cash
NANO NANO
XTZ Tezos
0.00015 BCH
EnglishPlease explain how she gets the shape of the 1st Tetrominoe

Const width = 10 In the tutorial the array is [1, width+1, width*2+1, 2] As I understand First index translates 1 => B1 Fourth index is 2 => C1 How does she point the center with width+1 and width*2+1? CSS if needed: .grid{ width: 200px; height: 400px; background-color: yellow; display: flex; flex-wrap: wrap; } .grid div{ height: 20px; width: 20px; background-color: red; } Thanks

godzilla34 3 years ago
    Tags:
  • Javascript
  • Coding
  • Code
  • Tetris
question_image


kimo2 3 years ago Correct
[1,width+1,width*2+1,2] => if width=10: [1, 11, 21, 2]
now find 1st, 11th, 21st and 2nd elements on the grid:
00 01 02 03 04 05 06 07 08 09
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29
it's L shape from the screenshot.
godzilla34 3 years ago
Hi, understood, so the issue was that she doesn't use the J,K,L cells after all and starts over from the 3rd cell. A,B,C,D,E,F,G,H,I
kimo2 3 years ago
The table is used only for illustration of different shapes.
10x20 field is very popular for Tetris, that's why width=10.