Open nickheidke opened 4 years ago
Seems like having a random card played would be funny most of the time, and probably the easiest to implement.
But... if you want to bring some data to it, here are some thoughts on how to do that:
(1) Easiest and most basic, non-AI mode. Score cards based on prior usage within the data. For a given black card, rank cards higher if they have been played on it, even higher if the judge picked it out of all white cards played. So you'd end up with a weights matrix, imagine black cards on the columns and white cards on the rows. Each element is just the number of times that white card has been played on that black card + the number of times the white card was chosen by the judge for that black card.
(1a) You could improve this by changing it from a count to a percentage (when this card was available to be played on this black card, here's the percent of the time it was chosen). Effectively this would be the same as up-weighting the chosen card and down-weighting the non-chosen cards.
All of this just produces some weight matrix, then you have the computer pick the highest-weighted white card for the given black card (or, so the computer doesn't get OP, you choose the highest weighted card in a random set of 10 or whatever).
The limitation with those is that you need a lot of data to get significant coverage over cards and get some informative weighting. If you're recording both the chosen cards and the available cards (like 1a) then you'd get a pretty big boost in terms of the number of cards you're getting info about per round of play (3 users, 7 cards per, that's 21 card weights being updated per black card). You're still going to get a lot of zero weights until you get a lot of play, but since completely random is still funny it would be fine to just pick a random card if you have no weights for a given batch of cards.
Two ways to use something that looks more like AI to get info on card pairings you haven't actually seen in the wild: (2) Use a https://en.wikipedia.org/wiki/Collaborative_filtering#Methodology (something like SVD), where the "users" are the black cards and the "items"/"movies" are the white cards. In this situation you are basically using information about which black cards tend to "prefer" similar white cards to each other. If B1 and B2 tend to be won by similar white cards, and W1 did well for B1, it probably would do well for B2. You'd get more information faster this way since you don't actually have to see the pairing between B2 and W1 in the data to get a somewhat informative weight for that pairing. (3) Much more AI-ish, difficult to implement, but more creative/interesting than the above. Use the words in the cards as datapoints. So instead of just looking at the cards as arbitrary B1, B2, you see them as buckets of words; B1 represented by the set [the, invisible, hand], for example. Then you (3a) score each white card word against each black card word, so if the word [hand] tends to appear frequently on cards played against black cards with the word [friend], then all cards with the word [hand] get up-weighted. This could potentially find some novel pairings more easily than the above, but given that there are many unique words on those cards this could be a lot of work for not a ton of information, which brings me finally to (3b) Use that external data to gather information about which words pair well together. Think of scraping reddit comment threads for some humor subreddit. If words appear together within a thread they probably are related in some funny way. Use that to come up with a word-word weighting (words upweighted if they appeared together on reddit), then for any given black card white card pairing just sum the word-word weights and you get the card weights. This is probably the hardest thing to do given the need for external data, but there are pre-canned "word embeddings" that you can get that I believe you could use to accomplish the same kind of word-word weightings. Maybe less funny since most of those pre-canned models use data from non-humorous sources (e.g. wikipedia) but still going to find you novel relevant cards.
When playing with a smaller group, it's often nice to add an extra "computer" or "random" card to the white cards. This computer player wouldn't need any true AI, it would just add a random card from its hand (or just the top white card from the deck) to the cards to pick from. When playing analog, this player doesn't get a black card since it can't randomly select a white card, but in this digital version that could be an option or not.