Mahjong as a 2D Array
Messing with data structures and ways of storing a Mahjong hand. Bellow is interactive! Click (or tap) to discard :3c
Ideally I'd also love to render your hand score as well, but that's for another time!
Here's the data type used for storing a hand:
type Hand<T = number> = [
/* Red 5 1 2 3 4 5 6 7 8 9 */
/* S */ [ T, T, T, T, T, T, T, T, T, T ],
/* P */ [ T, T, T, T, T, T, T, T, T, T ],
/* M */ [ T, T, T, T, T, T, T, T, T, T ],
/* Z */ [ null, T, T, T, T, T, T, T],
/* E S W N W G R */
];