summaryrefslogtreecommitdiff
path: root/pieces.c
diff options
context:
space:
mode:
Diffstat (limited to 'pieces.c')
-rw-r--r--pieces.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/pieces.c b/pieces.c
index 6199863..f1ed17c 100644
--- a/pieces.c
+++ b/pieces.c
@@ -5,23 +5,23 @@
const int N_SHAPES = 17;
const struct piece SHAPES[] = {
- {1, 1, "+"},
- {1, 2, "++"},
- {1, 3, "+++"},
- {1, 4, "++++"},
- {1, 5, "+++++"},
- {2, 2, "+ +"}, // 2x2 diagonal
- {2, 2, "++++"}, // 2x2 square
- {2, 3, "++++ "}, // L shape
- {2, 3, "++ ++"}, // Z shape
- {2, 3, "+++ + "}, // T shape
- {2, 3, "++++++"}, // 2x3 rectangle
- {2, 4, "+++++ "}, // long L shape
- {2, 4, "++++++++"}, // 2x4 rectangle
- {3, 3, "++++ + "}, // large L shape
- {3, 3, "+++ + + "}, // large T shape
- {3, 3, "+ + +"}, // 3x3 diagonal
- {3, 3, "+++++++++"}, // 3x3 square
+ {1, 1, 1, "+"},
+ {1, 2, 2, "++"},
+ {1, 3, 3, "+++"},
+ {1, 4, 4, "++++"},
+ {1, 5, 5, "+++++"},
+ {2, 2, 2, "+ +"}, // 2x2 diagonal
+ {2, 2, 4, "++++"}, // 2x2 square
+ {2, 3, 4, "++++ "}, // L shape
+ {2, 3, 4, "++ ++"}, // Z shape
+ {2, 3, 4, "+++ + "}, // T shape
+ {2, 3, 6, "++++++"}, // 2x3 rectangle
+ {2, 4, 5, "+++++ "}, // long L shape
+ {2, 4, 8, "++++++++"}, // 2x4 rectangle
+ {3, 3, 5, "++++ + "}, // large L shape
+ {3, 3, 5, "+++ + + "}, // large T shape
+ {3, 3, 3, "+ + +"}, // 3x3 diagonal
+ {3, 3, 9, "+++++++++"}, // 3x3 square
};
void transpose(struct piece* pc) {
@@ -66,6 +66,7 @@ struct piece* randpiece() {
struct piece* pc = malloc(sizeof(struct piece));
pc->h = shape.h;
pc->w = shape.w;
+ pc->points = shape.points;
pc->blocks = blocks;
if (rand() % 2) transpose(pc);
for (int i = rand() % 4; i > 0; i--) // 0 to 3 times