Page 871 - 2
P. 871

}
                    pieceShape = shape;


                }


                private void setX(int index, int x) { coords[index][0] = x; }
                private void setY(int index, int y) { coords[index][1] = y; }
                public int x(int index) { return coords[index][0]; }
                public int y(int index) { return coords[index][1]; }
                public Tetrominoes getShape() { return pieceShape; }


                public void setRandomShape()
                {
                    Random r = new Random();
                    int x = Math.abs(r.nextInt()) % 7 + 1;
                    Tetrominoes[] values = Tetrominoes.values();
                    setShape(values[x]);
                }


                public int minX()
                {
                  int m = coords[0][0];
                  for (int i=0; i < 4; i++) {
                      m = Math.min(m, coords[i][0]);
                  }
                  return m;
                }




                public int minY()
                {
                  int m = coords[0][1];
                  for (int i=0; i < 4; i++) {
                      m = Math.min(m, coords[i][1]);
                  }
                  return m;
                }


                public Shape rotateLeft()
                {
                    if (pieceShape == Tetrominoes.SquareShape)
                        return this;


                    Shape result = new Shape();
                    result.pieceShape = pieceShape;


                                                         - 871 -
   866   867   868   869   870   871   872   873   874   875   876