Anonymous user
Tetris/Java: Difference between revisions
m
no edit summary
m (change header) |
mNo edit summary |
||
Line 5:
import static java.lang.String.format;
import java.util.Arrays;
import java.util.Random;
import javax.swing.*;
Line 10 ⟶ 11:
public static final int EMPTY = -1;
public static final int BORDER = -2;
Shape fallingShape;
Line 20 ⟶ 19:
int fallingShapeCol;
final int blockSize = Config.blockSize;
final int nRows = Config.nRows;
final int nCols = Config.nCols;
final int topMargin = Config.topMargin;
final int leftMargin = Config.leftMargin;
Thread fallingThread;
final Scoreboard scoreboard = new Scoreboard();
static final Random rand = new Random();
public Tetris() {
Line 34 ⟶ 36:
setFocusable(true);
▲ grid = new int[nRows][nCols];
initGrid();
selectShape();
Line 100:
fallingShape = preSelectedShape;
Shape[] shapes = Shape.values();
preSelectedShape = shapes[
if (fallingShape != null)
fallingShape.reset();
|