Last active
March 7, 2023 00:31
-
-
Save barfi/fa165dfcfd3ea1ac92a00709551c0af7 to your computer and use it in GitHub Desktop.
Revisions
-
barfi revised this gist
Mar 7, 2023 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,18 @@ ```js // Case with 3 objects const abc = (p1, p2, map = { a:0, c:1, b:2 }) => { return ['DRAW', 'P1', 'P2'][(map[p1] - map[p2] + 3) % 3] } ``` ```js // Case with 4 objects const abcd = (p1, p2, map = { a:0, d:1, c:2, b:3 }) => { return ['DRAW', 'P1', 'P2'][(map[p1] - map[p2]) % 2 && (4 - ((map[p1] - map[p2] + 4) % 4)) % 3 + 1] } ``` ```js // Case with 5 objects const abcde = (p1, p2, map = { a:0, e:1, d:2, c:3, b:4 }) => { return ['DRAW', 'P1', 'P2'][((map[p1] - map[p2] + 5) % 5 - 1) % 2 + 1] } ``` -
barfi revised this gist
Mar 7, 2023 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,18 @@ ```js // Case with 3 objects const abc = (p1, p2, map = { a:0, c:1, b:2 }) => { return ['P1 == P2', 'P1', 'P2'][(map[p1] - map[p2] + 3) % 3] } ``` ```js // Case with 4 objects const abcd = (p1, p2, map = { a:0, d:1, c:2, b:3 }) => { return ['P1 == P2', 'P1', 'P2'][(map[p1] - map[p2]) % 2 && (4 - ((map[p1] - map[p2] + 4) % 4)) % 3 + 1] } ``` ```js // Case with 5 objects const abcde = (p1, p2, map = { a:0, e:1, d:2, c:3, b:4 }) => { return ['P1 == P2', 'P1', 'P2'][((map[p1] - map[p2] + 5) % 5 - 1) % 2 + 1] } ``` -
barfi renamed this gist
Mar 7, 2023 . 1 changed file with 10 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,18 @@ ```js // Case with 3 objects const abc = (x, y, map = { a:0, c:1, b:2 }) => { return ['P1 == P2', 'P1', 'P2'][(map[x] - map[y] + 3) % 3] } ``` ```js // Case with 4 objects const abcd = (x, y, map = { a:0, d:1, c:2, b:3 }) => { return ['P1 == P2', 'P1', 'P2'][(map[x] - map[y]) % 2 && (4 - ((map[x] - map[y] + 4) % 4)) % 3 + 1] } ``` ```js // Case with 5 objects const abcde = (x, y, map = { a:0, e:1, d:2, c:3, b:4 }) => { return ['P1 == P2', 'P1', 'P2'][((map[x] - map[y] + 5) % 5 - 1) % 2 + 1] } ``` -
barfi renamed this gist
Mar 7, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
barfi revised this gist
Mar 7, 2023 . 1 changed file with 9 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,20 @@ /** * Case with 3 objects */ const abc = (x, y, map = { a:0, c:1, b:2 }) => { return ['P1 == P2', 'P1', 'P2'][(map[x] - map[y] + 3) % 3] } /** * Case with 4 objects */ const abcd = (x, y, map = { a:0, d:1, c:2, b:3 }) => { return ['P1 == P2', 'P1', 'P2'][(map[x] - map[y]) % 2 && (4 - ((map[x] - map[y] + 4) % 4)) % 3 + 1] } /** * Case with 5 objects */ const abcde = (x, y, map = { a:0, e:1, d:2, c:3, b:4 }) => { return ['P1 == P2', 'P1', 'P2'][((map[x] - map[y] + 5) % 5 - 1) % 2 + 1] } -
barfi revised this gist
Mar 7, 2023 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,13 @@ /** * Case with 3 objects */ const abc = (x, y, map = {a:0,c:1,b:2}) => { return ['P1 == P2', 'P1', 'P2'][(map[x] - map[y] + 3) % 3] } /** * Case with 4 objects */ const abcd = (x, y, map = {a:0,d:1,c:2,b:3}){ return ['P1 == P2', 'P1', 'P2'][(map[x] - map[y]) % 2 && (4 - ((map[x] - map[y] + 4) % 4)) % 3 + 1] } -
barfi revised this gist
Mar 7, 2023 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ /** * Case with 3 objects */ const abc = (x, y, map = {a:0,c:1,b:2}) => { return ['P1 == P2', 'P1', 'P2'][(map[x] - map[y] + 3) % 3] } -
barfi renamed this gist
Mar 7, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
barfi created this gist
Mar 7, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ const abc = (x, y, map = {a:0,c:1,b:2}) => { return ['P1 == P2', 'P1', 'P2'][(map[x] - map[y] + 3) % 3] }