diff --git a/tetris/logs/tetris.log b/tetris/logs/tetris.log
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/tetris/src/main/java/edu/unl/cse/soft160/tetris/Tetris.java b/tetris/src/main/java/edu/unl/cse/soft160/tetris/Tetris.java
index ead888f5ba81b04a4761406cd445c479a140473e..1da45a5006d907ca15b265d356b2f7e117983e5e 100644
--- a/tetris/src/main/java/edu/unl/cse/soft160/tetris/Tetris.java
+++ b/tetris/src/main/java/edu/unl/cse/soft160/tetris/Tetris.java
@@ -10,10 +10,26 @@ import javax.swing.JFrame;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
public class Tetris extends JFrame {
private static final long serialVersionUID = -6851893161385783635L;
+ protected static void log(String message) {
+ try {
+ Files.write(Paths.get("logs/tetris.log"), (message + "\n").getBytes(), StandardOpenOption.CREATE, StandardOpenOption.APPEND);
+ } catch (IOException exception) {
+ exception.printStackTrace();
+ }
+ }
+
+ protected static void log(String moveName, int shape) {
+ log("Attempted move failed: " + moveName + " on shape " + shape + " (\"" + SHAPE_NAMES[shape] + "\")");
+ }
+
protected static int mod(int value, int modulus) {
int result = value % modulus;
return result < 0 ? result + modulus : result;
@@ -44,6 +60,7 @@ public class Tetris extends JFrame {
protected static final Color[] COLORS = { new Color(0, 0, 204), new Color(142, 0, 204), new Color(204, 204, 0),
new Color(204, 0, 204), new Color(0, 204, 204), new Color(0, 204, 0), new Color(204, 0, 0), };
+ protected static final String[] SHAPE_NAMES = { "O", "L", "J", "S", "Z", "T", "I", };
protected static final int[] SHAPE_WIDTHS = { 2, 3, 3, 3, 3, 3, 4, };
protected static final int[][][][] SHAPES = {
{ // O