I’ve built a couple of other Twitter bots, I have @kevinhookebot which generates random tweets generated from a trained ML model:
to expect the latest version that the dataset, that the same shows of the past complete of didn’t they started to do a company interesting
— Kevin Hooke Bot (@kevinhookebot) June 7, 2018
and I have a product name generator which generates humorous product names using the Tracery template library:
— ProductNameBot (@ProductNameBot) June 9, 2018
For my next project I’m thinking about what it would involve to build a multiplayer card game playing bot, a simple card game to get started, like Blackjack. The Twitter REST apis I’ve used so far will be reusable for this project, but the interesting parts are the interaction between a player and the bot, the game logic, and the persistence of game state (each of which I’ll discuss in future posts).
I’ve been thinking about the interaction for the gamevand think it will look something like this:
Player: @blackjackcard deal
Bot: @player bot deals you 4 Clubs and 7 Spades. Reply hit or stick
Player: @blackjackcard hit
Bot: @player bot deals you 4 Hearts. You now have 4 Clubs, 7 Spades, 4 Hearts. Reply hit or stick
Player: @blackjackcard stick
Bot: @player the bot currently has 3 Hearts, 9 Clubs, and takes a card
Bot: @player the bot takes 10 Diamonds and now has 3 Hearts, 9 Clubs, 10 Diamonds. Bust! You win!
The interesting part of the gameplay interaction is that there’s only 3 commands:
- deal: start a game (get dealt your initial two cards)
- hit: get dealt another card
- stick: keep current hard
This makes the options that the bot needs to handle pretty simple. Next up, I’ll talk about persisting the game state to AWS DynamoDB.