From 2b9841755eb5e38827f585e29a47b45d384a2513 Mon Sep 17 00:00:00 2001
From: Lemon <165233560+BludIsAnLemon@users.noreply.github.com>
Date: Sat, 18 Jan 2025 20:28:22 +0800
Subject: [PATCH 1/9] Update extensions
---
extensions/Cheddarphanie/logic.js | 139 ++++++++++++++++++++++++++++++
1 file changed, 139 insertions(+)
create mode 100644 extensions/Cheddarphanie/logic.js
diff --git a/extensions/Cheddarphanie/logic.js b/extensions/Cheddarphanie/logic.js
new file mode 100644
index 0000000000..bac31b0174
--- /dev/null
+++ b/extensions/Cheddarphanie/logic.js
@@ -0,0 +1,139 @@
+// Name: Logic
+// ID: lemonLogic
+// Description: A pack of handy logic operators.
+// By: Cheddarphanie
+// License: Apache-2.0
+
+(function(Scratch) {
+ "use strict";
+
+ if(!Scratch.extensions.unsandboxed) {
+ throw new Error("Logic must run unsandboxed.");
+ }
+
+ const Cast = Scratch.Cast;
+
+ class LogicExt {
+ getInfo() {
+ return {
+ id: "lemonLogic",
+ name: Scratch.translate("Logic"),
+ color1: "#59C059",
+ color2: "#50ad50",
+ color3: "#479a47",
+ blocks: [
+ {
+ opcode: 'Logic_NAND',
+ blockType: Scratch.BlockType.BOOLEAN,
+ text: "[A] NAND [B]",
+ arguments: {
+ A: {
+ type: Scratch.ArgumentType.BOOLEAN
+ },
+ B: {
+ type: Scratch.ArgumentType.BOOLEAN
+ }
+ },
+ extensions: ["colours_operators"]
+ },
+ {
+ opcode: 'Logic_NOR',
+ blockType: Scratch.BlockType.BOOLEAN,
+ text: "[A] NOR [B]",
+ arguments: {
+ A: {
+ type: Scratch.ArgumentType.BOOLEAN
+ },
+ B: {
+ type: Scratch.ArgumentType.BOOLEAN
+ }
+ },
+ extensions: ["colours_operators"]
+ },
+ {
+ opcode: 'Logic_XOR',
+ blockType: Scratch.BlockType.BOOLEAN,
+ text: "[A] XOR [B]",
+ arguments: {
+ A: {
+ type: Scratch.ArgumentType.BOOLEAN
+ },
+ B: {
+ type: Scratch.ArgumentType.BOOLEAN
+ }
+ },
+ extensions: ["colours_operators"]
+ },
+ {
+ opcode: 'Logic_XNOR',
+ blockType: Scratch.BlockType.BOOLEAN,
+ text: "[A] XNOR [B]",
+ arguments: {
+ A: {
+ type: Scratch.ArgumentType.BOOLEAN
+ },
+ B: {
+ type: Scratch.ArgumentType.BOOLEAN
+ }
+ },
+ extensions: ["colours_operators"]
+ },
+ {
+ opcode: 'Logic_IMPLY',
+ blockType: Scratch.BlockType.BOOLEAN,
+ text: "[A] IMPLY [B]",
+ arguments: {
+ A: {
+ type: Scratch.ArgumentType.BOOLEAN
+ },
+ B: {
+ type: Scratch.ArgumentType.BOOLEAN
+ }
+ },
+ extensions: ["colours_operators"]
+ },
+ {
+ opcode: 'Logic_NIMPLY',
+ blockType: Scratch.BlockType.BOOLEAN,
+ text: "[A] NIMPLY [B]",
+ arguments: {
+ A: {
+ type: Scratch.ArgumentType.BOOLEAN
+ },
+ B: {
+ type: Scratch.ArgumentType.BOOLEAN
+ }
+ },
+ extensions: ["colours_operators"]
+ }
+ ]
+ };
+ }
+
+ Logic_NAND({A, B}) {
+ [A, B] = [A, B].map(arg => Cast.toBoolean(arg));
+ return !(A && B);
+ }
+ Logic_NOR({A, B}) {
+ [A, B] = [A, B].map(arg => Cast.toBoolean(arg));
+ return !(A || B);
+ }
+ Logic_XOR({A, B}) {
+ [A, B] = [A, B].map(arg => Cast.toBoolean(arg));
+ return A !== B;
+ }
+ Logic_XNOR({A, B}) {
+ [A, B] = [A, B].map(arg => Cast.toBoolean(arg));
+ return A === B;
+ }
+ Logic_IMPLY({A, B}) {
+ [A, B] = [A, B].map(arg => Cast.toBoolean(arg));
+ return !A || B;
+ }
+ Logic_NIMPLY({A, B}) {
+ [A, B] = [A, B].map(arg => Cast.toBoolean(arg));
+ return A && !B;
+ }
+ }
+
+Scratch.extensions.register(new LogicExt());})(Scratch)
\ No newline at end of file
From 05b6d92d8aa859deb5a061dea04577e7bafe1214 Mon Sep 17 00:00:00 2001
From: Lemon <165233560+BludIsAnLemon@users.noreply.github.com>
Date: Sat, 18 Jan 2025 20:29:34 +0800
Subject: [PATCH 2/9] Update extensions.json
---
extensions/extensions.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/extensions/extensions.json b/extensions/extensions.json
index 9027c00ac9..f33493dc42 100644
--- a/extensions/extensions.json
+++ b/extensions/extensions.json
@@ -13,6 +13,7 @@
"local-storage",
"true-fantom/base",
"bitwise",
+ "Cheddarphanie/logic",
"Skyhigh173/bigint",
"utilities",
"sound",
From 6d9aa8cae946f6411cebc9a0027f194224a876dd Mon Sep 17 00:00:00 2001
From: Lemon <165233560+BludIsAnLemon@users.noreply.github.com>
Date: Sat, 18 Jan 2025 20:52:31 +0800
Subject: [PATCH 3/9] this should fix it(?)
---
extensions/Cheddarphanie/logic.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/extensions/Cheddarphanie/logic.js b/extensions/Cheddarphanie/logic.js
index bac31b0174..b7afd66d4b 100644
--- a/extensions/Cheddarphanie/logic.js
+++ b/extensions/Cheddarphanie/logic.js
@@ -22,6 +22,7 @@
color2: "#50ad50",
color3: "#479a47",
blocks: [
+ /* eslint-disable extension/should-translate */
{
opcode: 'Logic_NAND',
blockType: Scratch.BlockType.BOOLEAN,
From 010cdc9c8a18a39a4ee35e32326c4448ba6ae148 Mon Sep 17 00:00:00 2001
From: Lemon <165233560+BludIsAnLemon@users.noreply.github.com>
Date: Sat, 18 Jan 2025 20:54:16 +0800
Subject: [PATCH 4/9] fixed formatting
---
extensions/Cheddarphanie/logic.js | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/extensions/Cheddarphanie/logic.js b/extensions/Cheddarphanie/logic.js
index b7afd66d4b..e41bdb7927 100644
--- a/extensions/Cheddarphanie/logic.js
+++ b/extensions/Cheddarphanie/logic.js
@@ -24,7 +24,7 @@
blocks: [
/* eslint-disable extension/should-translate */
{
- opcode: 'Logic_NAND',
+ opcode: "Logic_NAND",
blockType: Scratch.BlockType.BOOLEAN,
text: "[A] NAND [B]",
arguments: {
@@ -38,7 +38,7 @@
extensions: ["colours_operators"]
},
{
- opcode: 'Logic_NOR',
+ opcode: "Logic_NOR",
blockType: Scratch.BlockType.BOOLEAN,
text: "[A] NOR [B]",
arguments: {
@@ -52,7 +52,7 @@
extensions: ["colours_operators"]
},
{
- opcode: 'Logic_XOR',
+ opcode: "Logic_XOR",
blockType: Scratch.BlockType.BOOLEAN,
text: "[A] XOR [B]",
arguments: {
@@ -66,7 +66,7 @@
extensions: ["colours_operators"]
},
{
- opcode: 'Logic_XNOR',
+ opcode: "Logic_XNOR",
blockType: Scratch.BlockType.BOOLEAN,
text: "[A] XNOR [B]",
arguments: {
@@ -80,7 +80,7 @@
extensions: ["colours_operators"]
},
{
- opcode: 'Logic_IMPLY',
+ opcode: "Logic_IMPLY",
blockType: Scratch.BlockType.BOOLEAN,
text: "[A] IMPLY [B]",
arguments: {
@@ -94,7 +94,7 @@
extensions: ["colours_operators"]
},
{
- opcode: 'Logic_NIMPLY',
+ opcode: "Logic_NIMPLY",
blockType: Scratch.BlockType.BOOLEAN,
text: "[A] NIMPLY [B]",
arguments: {
From e472e4d7d490bfbbe6ca0888d39f987ea4bf9dae Mon Sep 17 00:00:00 2001
From: Lemon <165233560+BludIsAnLemon@users.noreply.github.com>
Date: Sat, 18 Jan 2025 20:56:25 +0800
Subject: [PATCH 5/9] istg if this fixes the bug
---
extensions/Cheddarphanie/logic.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extensions/Cheddarphanie/logic.js b/extensions/Cheddarphanie/logic.js
index e41bdb7927..b7c20ba74c 100644
--- a/extensions/Cheddarphanie/logic.js
+++ b/extensions/Cheddarphanie/logic.js
@@ -106,7 +106,7 @@
}
},
extensions: ["colours_operators"]
- }
+ },
]
};
}
From 14b3ff304190b09354129acf2ca2fcb66efd90a6 Mon Sep 17 00:00:00 2001
From: Lemon <165233560+BludIsAnLemon@users.noreply.github.com>
Date: Sat, 18 Jan 2025 20:58:29 +0800
Subject: [PATCH 6/9] i may have forgotten another comma
---
extensions/Cheddarphanie/logic.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extensions/Cheddarphanie/logic.js b/extensions/Cheddarphanie/logic.js
index b7c20ba74c..5d69149049 100644
--- a/extensions/Cheddarphanie/logic.js
+++ b/extensions/Cheddarphanie/logic.js
@@ -107,7 +107,7 @@
},
extensions: ["colours_operators"]
},
- ]
+ ],
};
}
From 8abafa065b24637b72290e92131fba8bcb4936bf Mon Sep 17 00:00:00 2001
From: Lemon <165233560+BludIsAnLemon@users.noreply.github.com>
Date: Sat, 18 Jan 2025 21:01:37 +0800
Subject: [PATCH 7/9] putting commas everywhere fixes the formatting
---
extensions/Cheddarphanie/logic.js | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/extensions/Cheddarphanie/logic.js b/extensions/Cheddarphanie/logic.js
index 5d69149049..aeb374c603 100644
--- a/extensions/Cheddarphanie/logic.js
+++ b/extensions/Cheddarphanie/logic.js
@@ -33,9 +33,9 @@
},
B: {
type: Scratch.ArgumentType.BOOLEAN
- }
+ },
},
- extensions: ["colours_operators"]
+ extensions: ["colours_operators"],
},
{
opcode: "Logic_NOR",
@@ -47,9 +47,9 @@
},
B: {
type: Scratch.ArgumentType.BOOLEAN
- }
+ },
},
- extensions: ["colours_operators"]
+ extensions: ["colours_operators"],
},
{
opcode: "Logic_XOR",
@@ -61,9 +61,9 @@
},
B: {
type: Scratch.ArgumentType.BOOLEAN
- }
+ },
},
- extensions: ["colours_operators"]
+ extensions: ["colours_operators"],
},
{
opcode: "Logic_XNOR",
@@ -75,9 +75,9 @@
},
B: {
type: Scratch.ArgumentType.BOOLEAN
- }
+ },
},
- extensions: ["colours_operators"]
+ extensions: ["colours_operators"],
},
{
opcode: "Logic_IMPLY",
@@ -89,9 +89,9 @@
},
B: {
type: Scratch.ArgumentType.BOOLEAN
- }
+ },
},
- extensions: ["colours_operators"]
+ extensions: ["colours_operators"],
},
{
opcode: "Logic_NIMPLY",
@@ -103,9 +103,9 @@
},
B: {
type: Scratch.ArgumentType.BOOLEAN
- }
+ },
},
- extensions: ["colours_operators"]
+ extensions: ["colours_operators"],
},
],
};
From f9735a6615f1690179c2cb353765d2394191e330 Mon Sep 17 00:00:00 2001
From: Lemon <165233560+BludIsAnLemon@users.noreply.github.com>
Date: Sat, 18 Jan 2025 21:04:55 +0800
Subject: [PATCH 8/9] =?UTF-8?q?who=20made=20ts=20formatting=20=F0=9F=98=AD?=
=?UTF-8?q?=F0=9F=AB=B8=F0=9F=AB=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
extensions/Cheddarphanie/logic.js | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/extensions/Cheddarphanie/logic.js b/extensions/Cheddarphanie/logic.js
index aeb374c603..0d52fcb4bb 100644
--- a/extensions/Cheddarphanie/logic.js
+++ b/extensions/Cheddarphanie/logic.js
@@ -29,10 +29,10 @@
text: "[A] NAND [B]",
arguments: {
A: {
- type: Scratch.ArgumentType.BOOLEAN
+ type: Scratch.ArgumentType.BOOLEAN,
},
B: {
- type: Scratch.ArgumentType.BOOLEAN
+ type: Scratch.ArgumentType.BOOLEAN,
},
},
extensions: ["colours_operators"],
@@ -43,10 +43,10 @@
text: "[A] NOR [B]",
arguments: {
A: {
- type: Scratch.ArgumentType.BOOLEAN
+ type: Scratch.ArgumentType.BOOLEAN,
},
B: {
- type: Scratch.ArgumentType.BOOLEAN
+ type: Scratch.ArgumentType.BOOLEAN,
},
},
extensions: ["colours_operators"],
@@ -57,10 +57,10 @@
text: "[A] XOR [B]",
arguments: {
A: {
- type: Scratch.ArgumentType.BOOLEAN
+ type: Scratch.ArgumentType.BOOLEAN,
},
B: {
- type: Scratch.ArgumentType.BOOLEAN
+ type: Scratch.ArgumentType.BOOLEAN,
},
},
extensions: ["colours_operators"],
@@ -71,10 +71,10 @@
text: "[A] XNOR [B]",
arguments: {
A: {
- type: Scratch.ArgumentType.BOOLEAN
+ type: Scratch.ArgumentType.BOOLEAN,
},
B: {
- type: Scratch.ArgumentType.BOOLEAN
+ type: Scratch.ArgumentType.BOOLEAN,
},
},
extensions: ["colours_operators"],
@@ -85,10 +85,10 @@
text: "[A] IMPLY [B]",
arguments: {
A: {
- type: Scratch.ArgumentType.BOOLEAN
+ type: Scratch.ArgumentType.BOOLEAN,
},
B: {
- type: Scratch.ArgumentType.BOOLEAN
+ type: Scratch.ArgumentType.BOOLEAN,
},
},
extensions: ["colours_operators"],
@@ -99,10 +99,10 @@
text: "[A] NIMPLY [B]",
arguments: {
A: {
- type: Scratch.ArgumentType.BOOLEAN
+ type: Scratch.ArgumentType.BOOLEAN,
},
B: {
- type: Scratch.ArgumentType.BOOLEAN
+ type: Scratch.ArgumentType.BOOLEAN,
},
},
extensions: ["colours_operators"],
From 8662d2776cf6470413fb27585ab78f44f13a1786 Mon Sep 17 00:00:00 2001
From: "DangoCat[bot]"
Date: Sat, 18 Jan 2025 13:05:23 +0000
Subject: [PATCH 9/9] [Automated] Format code
---
extensions/Cheddarphanie/logic.js | 39 ++++++++++++++++---------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/extensions/Cheddarphanie/logic.js b/extensions/Cheddarphanie/logic.js
index 0d52fcb4bb..0501701364 100644
--- a/extensions/Cheddarphanie/logic.js
+++ b/extensions/Cheddarphanie/logic.js
@@ -4,15 +4,15 @@
// By: Cheddarphanie
// License: Apache-2.0
-(function(Scratch) {
+(function (Scratch) {
"use strict";
-
- if(!Scratch.extensions.unsandboxed) {
+
+ if (!Scratch.extensions.unsandboxed) {
throw new Error("Logic must run unsandboxed.");
}
-
+
const Cast = Scratch.Cast;
-
+
class LogicExt {
getInfo() {
return {
@@ -110,31 +110,32 @@
],
};
}
-
- Logic_NAND({A, B}) {
- [A, B] = [A, B].map(arg => Cast.toBoolean(arg));
+
+ Logic_NAND({ A, B }) {
+ [A, B] = [A, B].map((arg) => Cast.toBoolean(arg));
return !(A && B);
}
- Logic_NOR({A, B}) {
- [A, B] = [A, B].map(arg => Cast.toBoolean(arg));
+ Logic_NOR({ A, B }) {
+ [A, B] = [A, B].map((arg) => Cast.toBoolean(arg));
return !(A || B);
}
- Logic_XOR({A, B}) {
- [A, B] = [A, B].map(arg => Cast.toBoolean(arg));
+ Logic_XOR({ A, B }) {
+ [A, B] = [A, B].map((arg) => Cast.toBoolean(arg));
return A !== B;
}
- Logic_XNOR({A, B}) {
- [A, B] = [A, B].map(arg => Cast.toBoolean(arg));
+ Logic_XNOR({ A, B }) {
+ [A, B] = [A, B].map((arg) => Cast.toBoolean(arg));
return A === B;
}
- Logic_IMPLY({A, B}) {
- [A, B] = [A, B].map(arg => Cast.toBoolean(arg));
+ Logic_IMPLY({ A, B }) {
+ [A, B] = [A, B].map((arg) => Cast.toBoolean(arg));
return !A || B;
}
- Logic_NIMPLY({A, B}) {
- [A, B] = [A, B].map(arg => Cast.toBoolean(arg));
+ Logic_NIMPLY({ A, B }) {
+ [A, B] = [A, B].map((arg) => Cast.toBoolean(arg));
return A && !B;
}
}
-Scratch.extensions.register(new LogicExt());})(Scratch)
\ No newline at end of file
+ Scratch.extensions.register(new LogicExt());
+})(Scratch);