@@ -0,0 +1,1647 @@
+package tetris;%0A%0A/**%0A * Handles the logical and graphical condition of each block. Each block can be empty,%0A * occupied by a block, occupied by a shadow, and/or simu-cleared (scoring algorithm).%0A * %0A * @author dmayans%0A */%0A%0Aimport java.awt.Color;%0Aimport java.awt.Graphics;%0Aimport java.awt.Graphics2D;%0A%0Apublic class RectangleShape %7B%0A%09private int _width;%0A%09private int _height;%0A%09private int _x;%0A%09private int _y;%0A%09private Color _color;%0A%09private Color _borderColor;%0A%09private boolean _visible;%0A%09private boolean _on;%0A%09private boolean _simulated;%0A%09%0A%09public RectangleShape() %7B%0A%09%09_width = 0;%0A%09%09_height = 0;%0A%09%09_x = 0;%0A%09%09_y = 0;%0A%09%09_color = Color.BLACK;%0A%09%09_borderColor = Color.BLACK;%0A%09%09_visible = false;%0A%09%09_on = false;%0A%09%09_simulated = false;%0A%09%7D%0A%09%0A%09// Accessors%0A%09public boolean on() %7B%0A%09%09return _on;%0A%09%7D%0A%09%0A%09public boolean simulated() %7B%0A%09%09return _simulated;%0A%09%7D%0A%09%0A%09public boolean isShadow() %7B%0A%09%09return _color==Color.GRAY;%0A%09%7D%0A%09%0A%09// Mutators%0A%09public void setLocation(int x, int y) %7B%0A%09%09_x = x;%0A%09%09_y = y;%0A%09%7D%0A%09%0A%09public void flickOn(Color c) %7B%0A%09%09_color = c;%0A%09%09_on = true;%0A%09%7D%0A%09%0A%09public void flickOff() %7B%0A%09%09_color = Color.BLACK;%0A%09%09_on = false;%0A%09%7D%0A%09%0A%09public void simulate(boolean b) %7B%0A%09%09_simulated = b;%0A%09%7D%0A%09%0A%09public void setSize(int width, int height) %7B%0A%09%09_width = width;%0A%09%09_height = height;%0A%09%7D%0A%09%0A%09public void setBorderColor(Color c) %7B%0A%09%09_borderColor = c;%0A%09%7D%0A%09%0A%09public void setVisible(boolean b) %7B%0A%09%09_visible = b;%0A%09%7D%0A%09%0A%09public void paint(Graphics g) %7B%0A%09%09if(_visible) %7B%0A%09%09%09Graphics2D graphics = (Graphics2D) g;%0A%09%09%09graphics.setColor(_color);%0A%09%09%09graphics.fillRect(_x, _y, _width, _height);%0A%09%09%09graphics.setColor(_borderColor);%0A%09%09%09graphics.drawRect(_x,_y,_width,_height);%0A%09%09%7D%0A%09%7D%0A%7D%0A

Create RectangleShape.java