We learned about the Twilio API and we decided to make an SMS based game using it. We think there should be simple games that you can play across different platforms, since there are text-based games on iOS that only iOS users can play.

What it does

The program waits for someone to text "CONNECT4" to the Twilio, and then it asks for the user's name. Once a name is given, the program asks for a phone number that will be the opponent in the game. You can't type in dashes or parentheses for the phone number, otherwise nothing will happen. Then it sends a text message to the provided number asking them to play with a 'y' or 'n' response. If 'y' is entered, player 2 will enter their name and the game will start. If 'n' is entered, it will ask player 1 to try again if they want. During the game, a 7x6 board is sent to both players using white square emojis, with the number emojis from 1-7 printed below the board. It asks the user where to make their move, and it will display the choice on the board appropriately. This will keep going until someone wins or there is a tie, and will display the appropriate output.

How I built it

This app was built using Java, the Twilio API, as well as the Twiml and Spark APIs.

Challenges I ran into

Putting received text messages into strings for manipulation in the program Properly printing the board on one's phone Preventing infinite message loops

Accomplishments that I'm proud of

We were able to make a relatively stable version of the game that can be used in practical applications.

What I learned

How to include other people's API's into my own projects

Built With

Share this project: