Message Boards Message Boards

I made a Twitter bot that plays the card game "24s"


In the game of 24s, players turn over four cards from a deck that has had the face cards removed, thus revealing four integers between 1 and 10. Using each number exactly once and no additional numbers, they race to make the number 24. In simple versions of the game, only basic arithmetic operators are allowed. In more advanced games, additional operators, including unary operators can be used. Squaring and square roots are possible if you have a 2; cubing and cube roots are possible if you have a 3, etc.

So for example, given the cards 2, 3, 10, 10, several solutions are possible, among them

Simple: 2*(10-3) +10

Complex: 2^10 - 10^3

I have played this game with my children to help them practice rapid, simple mathematical calculation. I also programmed Mathematica to play the game (precomputing allowed solutions using techniques of algebraic programming). With the social media functions in Mathematica 11, I even created a bot that plays the game over Twitter. It runs on a Raspberry Pi and you can try it out with the hashtags #24sTest and #24sCheck. Any tweet that includes one of those hashtags and four allowed integers should produce a helpful response.

POSTED BY: Michael Stern
13 days ago

Group Abstract Group Abstract