{'fraction_non_alphanumeric': 0.03495145631067961, 'fraction_numerical': 0.01488673139158576, 'mean_word_length': 4.320137693631669, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
SkatBot : Teaching a Computer to Play Cards

This project taught a computer to play a popular German card game Skat. Gameplay data was collected using a computer gameplay simulation and reduced to a set of appropriate feature vectors. We applied Softmax regression and support vector machines (SVM) to predict the best card to play each turn. Cross-validation predicted human card outputs with around 48% (suit) and 64% (rank) accuracy. For additional validation, we created an AI to play the game using these algorithms. In a 75-game experiment, our SkatBot outperformed the baseline random algorithm by 7.44 points on average, but scored lower than the human team by 6.44-points. However, when the intrinsic variance of Skat scores is considered, the t-test of difference of means (at α = 0.05) concludes that there is a significant difference between the ability of SkatBot and the random algorithm, but not between SkatBot and the human team. Introduction Skat is a 3-player card game where two players team up against one. The cards are ordered by suit (♦, ♥, ♠, ♣) and by rank (7, 8, 9, Q, K, 10, A, J), and each card rank has a point value. The standalone player chooses one suit as trump suit, which beats all cards of other suits. Each player starts with 10 cards and plays one card per round. In each round, players must play a card of the same suit as the starting card unless they do not have any. The winner of a round wins the cards played and starts the next round. The team with the most points after 10 rounds wins the game One unique aspect of Skat is that no communication is allowed between players. This means no one knows what cards the other players have on their hands. However, knowing how the cards are probabilistically distributed is crucial to winning the game. There are some complex card-counting and non-verbal communication strategies that we expect the computer to learn by analyzing human playing patterns. Objective We want to train the computer to predict the best card to play per turn. The prediction algorithm can be applied repeatedly to play an entire game of Skat. A simplifying assumption we make is that the computer always plays as a member of the two-person team. Our card prediction strategy is a two-step process: 1) predict the suit of the best card to play, and 2) predict the rank, conditioned on the chosen suit. From a dataset of 41 games between humans, we extracted 282 training examples for suit prediction and 497 for rank prediction. Each example represents one instance when the player had a choice and is labeled with the actual human decision. Features Suit examples have 29 features and rank examples have 41, intuitively chosen to provide essential information such as number of cards on hand for each suit, the order of play, and whether cards on hand are winning (Appendix 1). Models Choosing the suit (k = 4) and the rank (k = 11) are two multiclass classification problems. We used two algorithms: 1. Softmax Regression with L2 regularization. We used gradient ascent to maximize: l θ =    1 y(!) = p ∗ θ!x − log exp θ!x !