Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

edited body
Source Link
138 Aspen
  • 7.3k
  • 1
  • 5
  • 18

Wolfram Language(Mathematica), 106105 bytes

Port of @SuperStormer's Python answer in Mathematica.


Golfed version, Try it online! Try it online!

106105 bytes, it can be golfed much more.

f[a_,b_]:=FromCharacterCode[ToCharacterCode["碧紅騮熏綠硅紫黯黻靘"][[Mod[Mod[Abs[a=FromCharacterCode@ToCharacterCode["碧紅騮熏綠硅紫黯黻靘"][[Mod[Mod[Abs[a-b],90],11]]]]11]]]

Ungolfed version. Try it online!

f[a_, b_] := 
 FromCharacterCode[
 ToCharacterCode["碧紅騮熏綠硅紫黯黻靘"][[((Abs[a - b]~Mod~ 90 )~Mod ~11)]]];
repl = {{"靑", "赤", "靘"}, {"赤", "黃", "熏"}, {"黃", "白", "硅"}, {"白", "黑", 
 "黻"}, {"黑", "靑", "黯"}, {"靑", "黃", "綠"}, {"黃", "黑", "騮"}, {"黑", 
 "赤", "紫"}, {"赤", "白", "紅"}, {"白", "靑", "碧"}};
Table[a = repl[[i, 1]]; b = repl[[i, 2]]; c = repl[[i, 3]]; 
 res = f[ToCharacterCode[a][[1]], ToCharacterCode[b][[1]]]; 
 Print[a, " ", b, " ", c, " ", res], {i, Length[repl]}];

Wolfram Language(Mathematica), 106 bytes

Port of @SuperStormer's Python answer in Mathematica.


Golfed version, Try it online!

106 bytes, it can be golfed much more.

f[a_,b_]:=FromCharacterCode[ToCharacterCode["碧紅騮熏綠硅紫黯黻靘"][[Mod[Mod[Abs[a-b],90],11]]]]

Ungolfed version. Try it online!

f[a_, b_] := 
 FromCharacterCode[
 ToCharacterCode["碧紅騮熏綠硅紫黯黻靘"][[((Abs[a - b]~Mod~ 90 )~Mod ~11)]]];
repl = {{"靑", "赤", "靘"}, {"赤", "黃", "熏"}, {"黃", "白", "硅"}, {"白", "黑", 
 "黻"}, {"黑", "靑", "黯"}, {"靑", "黃", "綠"}, {"黃", "黑", "騮"}, {"黑", 
 "赤", "紫"}, {"赤", "白", "紅"}, {"白", "靑", "碧"}};
Table[a = repl[[i, 1]]; b = repl[[i, 2]]; c = repl[[i, 3]]; 
 res = f[ToCharacterCode[a][[1]], ToCharacterCode[b][[1]]]; 
 Print[a, " ", b, " ", c, " ", res], {i, Length[repl]}];

Wolfram Language(Mathematica), 105 bytes

Port of @SuperStormer's Python answer in Mathematica.


Golfed version, Try it online!

105 bytes, it can be golfed much more.

f[a_,b_]:=FromCharacterCode@ToCharacterCode["碧紅騮熏綠硅紫黯黻靘"][[Mod[Mod[Abs[a-b],90],11]]]

Ungolfed version. Try it online!

f[a_, b_] := 
 FromCharacterCode[
 ToCharacterCode["碧紅騮熏綠硅紫黯黻靘"][[((Abs[a - b]~Mod~ 90 )~Mod ~11)]]];
repl = {{"靑", "赤", "靘"}, {"赤", "黃", "熏"}, {"黃", "白", "硅"}, {"白", "黑", 
 "黻"}, {"黑", "靑", "黯"}, {"靑", "黃", "綠"}, {"黃", "黑", "騮"}, {"黑", 
 "赤", "紫"}, {"赤", "白", "紅"}, {"白", "靑", "碧"}};
Table[a = repl[[i, 1]]; b = repl[[i, 2]]; c = repl[[i, 3]]; 
 res = f[ToCharacterCode[a][[1]], ToCharacterCode[b][[1]]]; 
 Print[a, " ", b, " ", c, " ", res], {i, Length[repl]}];
Source Link
138 Aspen
  • 7.3k
  • 1
  • 5
  • 18

Wolfram Language(Mathematica), 106 bytes

Port of @SuperStormer's Python answer in Mathematica.


Golfed version, Try it online!

106 bytes, it can be golfed much more.

f[a_,b_]:=FromCharacterCode[ToCharacterCode["碧紅騮熏綠硅紫黯黻靘"][[Mod[Mod[Abs[a-b],90],11]]]]

Ungolfed version. Try it online!

f[a_, b_] := 
 FromCharacterCode[
 ToCharacterCode["碧紅騮熏綠硅紫黯黻靘"][[((Abs[a - b]~Mod~ 90 )~Mod ~11)]]];
repl = {{"靑", "赤", "靘"}, {"赤", "黃", "熏"}, {"黃", "白", "硅"}, {"白", "黑", 
 "黻"}, {"黑", "靑", "黯"}, {"靑", "黃", "綠"}, {"黃", "黑", "騮"}, {"黑", 
 "赤", "紫"}, {"赤", "白", "紅"}, {"白", "靑", "碧"}};
Table[a = repl[[i, 1]]; b = repl[[i, 2]]; c = repl[[i, 3]]; 
 res = f[ToCharacterCode[a][[1]], ToCharacterCode[b][[1]]]; 
 Print[a, " ", b, " ", c, " ", res], {i, Length[repl]}];

AltStyle によって変換されたページ (->オリジナル) /