Determining the legality of shengji plays
I’ve been working on my online version of the shengji card game for a little while now. One of the more interesting aspects of the game is how a legal play is defined, and the corresponding algorithm to compute that.
Problem overview Shengji is a trick-taking game, which means that in each round, every player plays the same number of cards. The first player in the trick sets the “format” of the trick, which subsequent players must attempt to follow.