aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/src/model
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2023-11-04 15:25:06 +0000
committerLeonardo Bishop <me@leonardobishop.com>2023-11-04 15:25:06 +0000
commit9f83ab70cfd5f2c41a23593f8ee5065b1015e242 (patch)
treed5bc21382cf3e5e38db6af5ab0f6e2ad5ef37c86 /frontend/src/model
parentef7a5e4cc01cfdc4a2594cb408a1dfd889ebb51f (diff)
Add frontend
Diffstat (limited to 'frontend/src/model')
-rw-r--r--frontend/src/model/board.ts1
-rw-r--r--frontend/src/model/tetrominoes.ts230
2 files changed, 231 insertions, 0 deletions
diff --git a/frontend/src/model/board.ts b/frontend/src/model/board.ts
new file mode 100644
index 0000000..c69befe
--- /dev/null
+++ b/frontend/src/model/board.ts
@@ -0,0 +1 @@
+export type Board = Array<Array<string | number>>; \ No newline at end of file
diff --git a/frontend/src/model/tetrominoes.ts b/frontend/src/model/tetrominoes.ts
new file mode 100644
index 0000000..1d91c10
--- /dev/null
+++ b/frontend/src/model/tetrominoes.ts
@@ -0,0 +1,230 @@
+export type Tetromino = {
+ id: string;
+ shapes: Array<Array<Array<string | number>>>;
+ color: string;
+ rotation: number;
+ col: number;
+ row: number;
+ width: number;
+ height: number;
+};
+
+export const Tetrominoes: { [key: string]: Tetromino } = {
+ I: {
+ id: "I",
+ shapes: [
+ [
+ [0, "I", 0, 0],
+ [0, "I", 0, 0],
+ [0, "I", 0, 0],
+ [0, "I", 0, 0],
+ ],
+ [
+ [0, 0, 0, 0],
+ ["I", "I", "I", "I"],
+ [0, 0, 0, 0],
+ [0, 0, 0, 0],
+ ],
+ [
+ [0, "I", 0, 0],
+ [0, "I", 0, 0],
+ [0, "I", 0, 0],
+ [0, "I", 0, 0],
+ ],
+ [
+ [0, 0, 0, 0],
+ ["I", "I", "I", "I"],
+ [0, 0, 0, 0],
+ [0, 0, 0, 0],
+ ],
+ ],
+ color: "80, 227, 230",
+ rotation: 0,
+ col: 0,
+ row: 0,
+ width: 4,
+ height: 4,
+ },
+ J: {
+ id: "J",
+ shapes: [
+ [
+ [0, "J", 0],
+ [0, "J", 0],
+ ["J", "J", 0],
+ ],
+ [
+ ["J", 0, 0],
+ ["J", "J", "J"],
+ [0, 0, 0],
+ ],
+ [
+ [0, "J", "J"],
+ [0, "J", 0],
+ [0, "J", 0],
+ ],
+ [
+ [0, 0, 0],
+ ["J", "J", "J"],
+ [0, 0, "J"],
+ ],
+ ],
+ color: "36, 95, 223",
+ rotation: 0,
+ col: 0,
+ row: 0,
+ width: 3,
+ height: 3,
+ },
+ L: {
+ id: "L",
+ shapes: [
+ [
+ [0, "L", 0],
+ [0, "L", 0],
+ [0, "L", "L"],
+ ],
+ [
+ [0, 0, 0],
+ ["L", "L", "L"],
+ ["L", 0, 0],
+ ],
+ [
+ ["L", "L", 0],
+ [0, "L", 0],
+ [0, "L", 0],
+ ],
+ [
+ [0, 0, "L"],
+ ["L", "L", "L"],
+ [0, 0, 0],
+ ],
+ ],
+ color: "223, 173, 36",
+ rotation: 0,
+ col: 0,
+ row: 0,
+ width: 3,
+ height: 3,
+ },
+ O: {
+ id: "O",
+ shapes: [
+ [
+ ["O", "O"],
+ ["O", "O"],
+ ],
+ [
+ ["O", "O"],
+ ["O", "O"],
+ ],
+ [
+ ["O", "O"],
+ ["O", "O"],
+ ],
+ [
+ ["O", "O"],
+ ["O", "O"],
+ ],
+ ],
+ color: "223, 217, 36",
+ rotation: 0,
+ col: 0,
+ row: 0,
+ width: 2,
+ height: 2,
+ },
+ S: {
+ id: "S",
+ shapes: [
+ [
+ [0, "S", "S"],
+ ["S", "S", 0],
+ [0, 0, 0],
+ ],
+ [
+ [0, "S", 0],
+ [0, "S", "S"],
+ [0, 0, "S"],
+ ],
+ [
+ [0, 0, 0],
+ [0, "S", "S"],
+ ["S", "S", 0],
+ ],
+ [
+ ["S", 0, 0],
+ ["S", "S", 0],
+ [0, "S", 0],
+ ],
+ ],
+ color: "48, 211, 56",
+ rotation: 0,
+ col: 0,
+ row: 0,
+ width: 3,
+ height: 3,
+ },
+ T: {
+ id: "T",
+ shapes: [
+ [
+ [0, 0, 0],
+ ["T", "T", "T"],
+ [0, "T", 0],
+ ],
+ [
+ [0, "T", 0],
+ ["T", "T", 0],
+ [0, "T", 0],
+ ],
+ [
+ [0, "T", 0],
+ ["T", "T", "T"],
+ [0, 0, 0],
+ ],
+ [
+ [0, "T", 0],
+ [0, "T", "T"],
+ [0, "T", 0],
+ ],
+ ],
+ color: "132, 61, 198",
+ rotation: 0,
+ col: 0,
+ row: 0,
+ width: 3,
+ height: 3,
+ },
+ Z: {
+ id: "Z",
+ shapes: [
+ [
+ ["Z", "Z", 0],
+ [0, "Z", "Z"],
+ [0, 0, 0],
+ ],
+ [
+ [0, 0, "Z"],
+ [0, "Z", "Z"],
+ [0, "Z", 0],
+ ],
+ [
+ [0, 0, 0],
+ ["Z", "Z", 0],
+ [0, "Z", "Z"],
+ ],
+ [
+ [0, "Z", 0],
+ ["Z", "Z", 0],
+ ["Z", 0, 0],
+ ],
+ ],
+ color: "227, 78, 78",
+ rotation: 0,
+ col: 0,
+ row: 0,
+ width: 3,
+ height: 3,
+ },
+};