Last active
June 13, 2019 10:15
-
-
Save ufcpp/2b44f6c7f5e3d4d7e39f2f6bd1d1f8bb to your computer and use it in GitHub Desktop.
「人種のるつぼ」ネタをtwitterで見かけて、つい
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 characters
using static System.Linq.Enumerable; | |
var parentals = new[] { "👩", "👨" }; | |
var infants = new[] { "👦", "👧" }; | |
var skinTones = new[] { "🏻", "🏼", "🏽", "🏾", "🏿" }; | |
const char zwj = '\u200D'; | |
var families = | |
from a in from f in parentals from s in skinTones select f + s | |
from b in from f in parentals from s in skinTones select f + s | |
from c in from f in infants from s in skinTones select f + s | |
from d in from f in infants from s in skinTones select f + s | |
select a + zwj + b + zwj + c + zwj + d; | |
foreach (var f in families) | |
{ | |
Console.Write(f); | |
} |
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 characters
using System.Collections.Generic; | |
using System.Linq; | |
using static System.Console; | |
static IEnumerable<T> Times<T>(this int n, T item) => Enumerable.Range(0, n).Select(_ => item); | |
static string MakeFamily(this IEnumerable<string> faces) => string.Join("\u200D", faces); | |
// いくつでもくっつく | |
WriteLine(10.Times("👩").MakeFamily()); | |
WriteLine(10.Times("👨").MakeFamily()); | |
// くっつかない!(グリフとしてはくっつかないけど、ZWJ 挟まってるのでエディターによってはカーソル移動1回扱い) | |
WriteLine(10.Times("👧").MakeFamily()); | |
WriteLine(10.Times("👦").MakeFamily()); | |
// 親の後ろに子供はくっつく(逆はダメ) | |
WriteLine(10.Times("👩").Append("👧").MakeFamily()); | |
// 親、親、子、子はくっつく | |
WriteLine(new[] { "👩", "👩", "👧", "👧" }.MakeFamily()); | |
// 子の後ろにはもうくっつかない | |
WriteLine(new[] { "👩", "👧", "👧", "👩" }.MakeFamily()); | |
WriteLine(new[] { "👧", "👩", "👧", "👩" }.MakeFamily()); | |
// でもなぜか、親、子、親、子の順だとくっつく (2家族作られて、それがさらにくっついてるんだと思う) | |
WriteLine(new[] { "👩", "👧", "👩", "👧" }.MakeFamily()); | |
// 子供がくっつくのは2人まで(でも、3人目以降も小さくなる) | |
WriteLine(new[] { "👩", "👩", "👧" }.MakeFamily()); | |
WriteLine(new[] { "👩", "👩", "👧", "👧" }.MakeFamily()); | |
WriteLine(new[] { "👩", "👩", "👧", "👧", "👧" }.MakeFamily()); | |
WriteLine(new[] { "👩", "👩", "👧", "👧", "👧", "👧" }.MakeFamily()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment