We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 129575a commit 052fb97Copy full SHA for 052fb97
src/index.js
@@ -0,0 +1,41 @@
1
+/**
2
+ * @type {import("chancellor")}
3
+ */
4
+let chancellor;
5
+
6
7
+ * @type {import("chancellor").flipcoin}
8
9
+let flipcoin;
10
11
12
+async function initialize () {
13
+ if (chancellor) return;
14
15
+ chancellor = await import("chancellor");
16
17
+ flipcoin = chancellor.flipcoin;
18
+}
19
20
21
+async function run (input) {
22
+ await initialize();
23
24
+ const x = input[0];
25
+ const y = input[1];
26
27
+ let output = [ x, y ];
28
29
+ if (flipcoin()) {
30
+ output[0] += y;
31
+ output[1] *= 0.5;
32
+ } else {
33
+ output[0] *= 0.5;
34
+ output[1] += x;
35
+ }
36
37
+ return output;
38
39
40
41
+module.exports = run;
0 commit comments