Message Boards Message Boards

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

Posted 6 years ago

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
Posted 5 months ago

In response to a question that was posted here and then deleted, you can see a discussion of my solution method, an analysis of results, and samples of interesting solutions at and linked pages.

POSTED BY: Michael Stern
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract