Skip to content

Commit aa49a0d

Browse files
committed
Updated AI tac_tac_toe agent
1 parent 81b75cf commit aa49a0d

File tree

8 files changed

+320
-657
lines changed

8 files changed

+320
-657
lines changed
Lines changed: 82 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
11
# 🎮 Agent X vs Agent O: Tic-Tac-Toe Game
22

3-
An interactive Tic-Tac-Toe game where two AI agents powered by different language models compete against each other built on Agno Agent Framework and Streamlit as UI. Watch as GPT-4O battles against either DeepSeek V3 or Google's Gemini 1.5 Flash in this classic game.
3+
An interactive Tic-Tac-Toe game where two AI agents powered by different language models compete against each other built on Agno Agent Framework and Streamlit as UI.
44

5-
## Features
6-
7-
### Multi-Agent System
8-
- Player X: OpenAI's Gemini Flash 2.0
9-
- Player O: DeepSeek v3
10-
- Judge: GPT-4o for game outcome validation
11-
12-
### Interactive Interface
13-
- Real-time game board visualization
14-
- Move-by-move analysis
15-
- Agent response tracking
16-
- Clear game status updates
5+
This example shows how to build an interactive Tic Tac Toe game where AI agents compete against each other. The application showcases how to:
6+
- Coordinate multiple AI agents in a turn-based game
7+
- Use different language models for different players
8+
- Create an interactive web interface with Streamlit
9+
- Handle game state and move validation
10+
- Display real-time game progress and move history
1711

18-
### Strategic Gameplay
19-
- AI-powered move decisions
20-
- Winning strategy implementation
21-
- Opponent move blocking
22-
- Victory condition monitoring
23-
24-
## Prerequisites
25-
- Python 3.8+
26-
- OpenAI API key
27-
- Either DeepSeek API key or Google API key (for Player O)
12+
## Features
13+
- Multiple AI models support (GPT-4, Claude, Gemini, etc.)
14+
- Real-time game visualization
15+
- Move history tracking with board states
16+
- Interactive player selection
17+
- Game state management
18+
- Move validation and coordination
2819

29-
## How to Run
20+
## How to Run?
3021

3122
1. **Setup Environment**
3223
```bash
@@ -38,40 +29,78 @@ An interactive Tic-Tac-Toe game where two AI agents powered by different languag
3829
pip install -r requirements.txt
3930
```
4031

41-
2. **Configure API Keys**
42-
- Get OpenAI API key from [OpenAI Platform](https://platform.openai.com)
43-
- Get Google API key from [Google AI Studio](https://aistudio.google.com) (if using Gemini)
44-
- Get DeepSeek API key from DeepSeek platform [Deepseek platform](https://www.deepseek.com) (if using DeepSeek v3 model)
32+
### 2. Install dependencies
4533

46-
4. **Run the Application**
47-
```bash
48-
streamlit run ai_tic_tac_toe_agent.py
49-
```
34+
```shell
35+
pip install -r requirements.txt
36+
```
37+
38+
### 3. Export API Keys
39+
40+
The game supports multiple AI models. Export the API keys for the models you want to use:
41+
42+
```shell
43+
# Required for OpenAI models
44+
export OPENAI_API_KEY=***
45+
46+
# Optional - for additional models
47+
export ANTHROPIC_API_KEY=*** # For Claude models
48+
export GOOGLE_API_KEY=*** # For Gemini models
49+
export GROQ_API_KEY=*** # For Groq models
50+
```
51+
52+
### 4. Run the Game
53+
54+
```shell
55+
streamlit run app.py
56+
```
57+
58+
- Open [localhost:8501](http://localhost:8501) to view the game interface
59+
60+
## How It Works
61+
62+
The game consists of three agents:
63+
64+
1. **Master Agent (Referee)**
65+
- Coordinates the game
66+
- Validates moves
67+
- Maintains game state
68+
- Determines game outcome
69+
70+
2. **Two Player Agents**
71+
- Make strategic moves
72+
- Analyze board state
73+
- Follow game rules
74+
- Respond to opponent moves
5075

51-
5. **Using the Interface**
52-
- Enter your API keys in the sidebar
53-
- Click "Start Game" to begin
54-
- Watch as the AI agents battle it out!
55-
- Monitor the game progress and final results
76+
## Available Models
5677

57-
## Game Components
78+
The game supports various AI models:
79+
- GPT-4o (OpenAI)
80+
- GPT-o3-mini (OpenAI)
81+
- Gemini (Google)
82+
- Llama 3 (Groq)
83+
- Claude (Anthropic)
5884

59-
- **Game Board**
60-
- 3x3 interactive grid
61-
- Real-time move visualization
62-
- Clear symbol placement (X/O)
85+
## Game Features
6386

64-
- **AI Agent Players**
65-
- Player X: Strategic offensive moves
66-
- Player O: Defensive countermoves since this agent started later
67-
- AI Judge: Game outcome validation
87+
1. **Interactive Board**
88+
- Real-time updates
89+
- Visual move tracking
90+
- Clear game status display
6891

69-
- **Game Flow**
70-
- Alternating turns between AIs
71-
- Move validation and error handling
72-
- Winner determination
73-
- Draw detection
92+
2. **Move History**
93+
- Detailed move tracking
94+
- Board state visualization
95+
- Player action timeline
7496

75-
## Disclaimer ⚠️
97+
3. **Game Controls**
98+
- Start/Pause game
99+
- Reset board
100+
- Select AI models
101+
- View game history
76102

77-
This is a demonstration project showcasing AI capabilities in game playing. API costs will apply based on your usage of the OpenAI, DeepSeek, or Google APIs.
103+
4. **Performance Analysis**
104+
- Move timing
105+
- Strategy tracking
106+
- Game statistics

0 commit comments

Comments
 (0)