|
@@ -0,0 +1,111 @@
|
|
|
+#include <u.h>
|
|
|
+#include <libc.h>
|
|
|
+#include <draw.h>
|
|
|
+#include <thread.h>
|
|
|
+#include <mouse.h>
|
|
|
+#include <keyboard.h>
|
|
|
+
|
|
|
+#define N 5
|
|
|
+
|
|
|
+typedef struct Piece Piece;
|
|
|
+struct Piece{
|
|
|
+ short rot;
|
|
|
+ short tx;
|
|
|
+ Point sz;
|
|
|
+ Point d[N];
|
|
|
+};
|
|
|
+
|
|
|
+Piece pieces[]={
|
|
|
+ { 0, 1, 5,1, { 0,0, 1,0, 1,0, 1,0, 1,0 }},
|
|
|
+ { 1, 1, 1,5, { 0,0, 0,1, 0,1, 0,1, 0,1 }},
|
|
|
+ { 2, 1, 5,1, { 0,0, 1,0, 1,0, 1,0, 1,0 }},
|
|
|
+ { 3, 1, 1,5, { 0,0, 0,1, 0,1, 0,1, 0,1 }},
|
|
|
+
|
|
|
+ { 0, 0, 4,2, { 0,0, 1,0, 1,0, 1,0, 0,1 }},
|
|
|
+ { 1, 0, 2,4, { 1,0, 0,1, 0,1, 0,1, -1,0 }},
|
|
|
+ { 2, 0, 4,2, { 0,0, 0,1, 1,0, 1,0, 1,0 }},
|
|
|
+ { 3, 0, 2,4, { 0,0, 1,0, -1,1, 0,1, 0,1 }},
|
|
|
+
|
|
|
+ { 0, 2, 4,2, { 0,0, 0,1, 1,-1, 1,0, 1,0 }},
|
|
|
+ { 1, 2, 2,4, { 0,0, 1,0, 0,1, 0,1, 0,1 }},
|
|
|
+ { 2, 2, 4,2, { 0,1, 1,0, 1,0, 1,0, 0,-1}},
|
|
|
+ { 3, 2, 2,4, { 0,0, 0,1, 0,1, 0,1, 1,0 }},
|
|
|
+
|
|
|
+ { 0, 7, 3,3, { 0,0, 1,0, 1,0, 0,1, 0,1 }},
|
|
|
+ { 1, 7, 3,3, { 0,2, 1,0, 1,0, 0,-1, 0,-1}},
|
|
|
+ { 2, 7, 3,3, { 0,0, 0,1, 0,1, 1,0, 1,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