DEV Community

dami
dami

Posted on • Updated on

Twilio Challenge: Can You Beat Gemini? AI-Powered Game of Tic Tac Toe

This is a submission for the Twilio Challenge

What I Built

I built an interactive AI-powered game of Tic-Tac-Toe called "Can You Beat Gemini?" This project allows players to test their Tic-Tac-Toe skills against Gemini AI, providing a challenging and fun experience.

Features

AI Integration: The game uses the Gemini AI model to analyse the game state and predict the best possible moves to challenge the player effectively.

Real-Time Interaction: Players interact with the game through digits (1-9). The game captures the player's move and processes it. The AI then responds with its move. This interaction is facilitated using Twilio's Programmable Voice capabilities, making the gameplay seamless and engaging.

Dynamic Game Board: The game state is visually represented, updating in real-time as moves are made. This ensures players can keep track of their and the AI's moves.

Demo

You can try it out by scanning the QR Code in the image or by texting the code join front-trace to the number +14155238886 on WhatsApp. Next call number +1 (806) 615-3056 to play the Tic Tac Toe game.

Image description

Video of How it Works

In the video description above, a call is made to +1 (806) 615-3056 to begin the game. The user selects any number between (1-9) to make their move. Gemini AI then analyzes the game state and responds with its move. The game continues with the user and AI taking turns until a winner emerges.

Source Code

Can You Beat Gemini? Tic Tac Toe

Welcome to the Can You Beat Gemini? Tic Tac Toe project! This is an interactive Tic-Tac-Toe game where you play against an AI opponent named Gemini(Gemini API). The AI is designed to challenge your strategic thinking and make your Tic-Tac-Toe games more interesting.

Video Demo

RPReplay_Final1718633328.mov

How it works

Twilio Programmable Voice is used to get input from the user in digits (1-9), each representing a cell on the Tic-Tac-Toe board. Then, Gemini AI to play against the human user. Finally, Twilio Messaging API (WhatsApp) is used to send the updated board when both AI and human players make their moves. Twilio Functions was used to host the code.




Twilio and AI

I used Twilio to get input from the user in digits (1-9), each representing a cell on the Tic-Tac-Toe board. Then, I used Gemini AI to play against the human user. Finally, I used the Twilio Programmable Messaging (WhatsApp Sandbox) to send the updated board when both AI and human players make their moves. I also used Twilio Functions to host the code.

Additional Prize Categories

Twilio Times Two - The project uses Twilio Programmable Messaging (WhatsApp Sandbox), Twilio Programmable Voice and, Twilio Functions.

Entertaining Endeavors - The project creatively combines a classic game with advanced AI technology, making it not just a simple Tic Tac Toe game but an engaging battle of wits against an AI opponent. By leveraging Twilio to receive user inputs and send real-time game updates via WhatsApp, the project ensures continuous engagement and keeps the players entertained throughout the game.

Top comments (25)

Collapse
 
ibileye_fisayomi_e9bcb35f profile image
Ibileye Fisayomi

Wow!!!

Collapse
 
ibileye_fisayomi_e9bcb35f profile image
Ibileye Fisayomi

Nice work!

Collapse
 
samuel_ruthmedese_16b09b profile image
Samuel Ruth Medese

This is nice!!

Collapse
 
unwana_mark_6e70b23a17912 profile image
Unwana Mark

Very interesting

Collapse
 
unwana_mark_6e70b23a17912 profile image
Unwana Mark

Wow

Collapse
 
unwana_mark_6e70b23a17912 profile image
Unwana Mark

This is really good

Collapse
 
faithyybaby profile image
Faith

This is intriguing.

Collapse
 
faithyybaby profile image
Faith

Keep up this good work.

Collapse
 
padonu_blessing_a9f92c477 profile image
Padonu Blessing

This is amazing work

Collapse
 
padonu_blessing_a9f92c477 profile image
Padonu Blessing

Wow