Skip to content

A beautiful, modern Connect Four game with AI opponent and engaging features.

License

Notifications You must be signed in to change notification settings

nranjan21/Plot-Four-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Modern Connect Four Game

A beautiful, modern Connect Four game with AI opponent and engaging features.

Python License Status

โœจ Features

๐ŸŽจ Modern UI Design

  • Clean Interface: Professional, modern design
  • Color-Coded Elements: Intuitive visual feedback
  • Responsive Layout: Three-panel design
  • Real-Time Updates: Live game status and scores

๐Ÿค– Advanced AI Opponent

  • 3 Difficulty Levels: Easy, Medium, Hard
  • Smart Strategy: Blocks threats and seeks wins
  • Minimax Algorithm: Optimal play on hard difficulty
  • Adaptive AI: Adjusts strategy based on difficulty

๐ŸŽฏ Game Features

  • Player vs AI: Challenge the computer
  • Player vs Player: Local multiplayer
  • Undo Move: Take back your last move
  • Score Tracking: Win counters and statistics
  • Game Modes: Switch between PvP and PvE

๐Ÿš€ Quick Start

Run the Game

python connect_four.py

Requirements

  • Python 3.8+ (uses only standard library)
  • tkinter (included with Python)
  • No additional dependencies required!

๐ŸŽฎ How to Play

  1. Start the Game: Click "๐ŸŽฎ Start Game"
  2. Make Moves: Click on any column to drop your piece
  3. Win Condition: Get 4 pieces in a row (horizontal, vertical, or diagonal)
  4. Controls:
    • ๐ŸŽฎ Start Game - Begin a new game
    • ๐Ÿ”„ Reset - Reset the current game
    • โ†ถ Undo - Undo your last move
    • Game Mode - Switch between Player vs AI and Player vs Player

๐ŸŽฏ Game Modes

Player vs AI (PvE)

  • Play against computer opponent
  • 3 difficulty levels:
    • Easy: Random moves with basic strategy
    • Medium: Blocks threats, seeks wins
    • Hard: Minimax algorithm, optimal play

Player vs Player (PvP)

  • Two human players take turns
  • Perfect for local multiplayer
  • Equal playing field

๐ŸŽจ UI Features

  • Purple Header: Modern gradient header design
  • Three-Panel Layout: Players, Game Board, Controls
  • Color-Coded Buttons:
    • Blue: Start Game
    • Green: Reset
    • Orange: Undo
  • Real-Time Status: Current player and game state
  • Score Tracking: Win counters for both players

๐Ÿ”ง Technical Details

Architecture

  • Game Engine: connect_four_game.py - Core game logic
  • GUI Interface: connect_four.py - Modern UI
  • Clean Code: Well-structured, maintainable code

Algorithms

  • Win Detection: Optimized 4-directional checking
  • AI Strategy: Minimax with alpha-beta pruning
  • Board Evaluation: Position scoring system
  • Move Generation: Efficient valid move detection

Performance

  • Time Complexity: O(1) for moves, O(n) for win detection
  • Space Complexity: O(rows ร— cols) for board storage
  • AI Depth: Configurable search depth (default: 4)

๐Ÿ“ Project Structure

PlotFour/
โ”œโ”€โ”€ connect_four.py          # ๐ŸŽฎ Main GUI application
โ”œโ”€โ”€ connect_four_game.py     # ๐Ÿง  Game engine and AI
โ”œโ”€โ”€ requirements.txt         # ๐Ÿ“‹ Dependencies (none required!)
โ”œโ”€โ”€ README.md               # ๐Ÿ“– This documentation
โ”œโ”€โ”€ .gitignore              # ๐Ÿšซ Git ignore file
โ”œโ”€โ”€ plot_four.cpp           # ๐Ÿ“œ Original C++ version
โ””โ”€โ”€ LICENSE                 # ๐Ÿ“„ MIT License

๐ŸŽ‰ Features Summary

Modern UI with clean, professional design
AI Opponent with 3 difficulty levels
Game Modes (PvP and PvE)
Undo Functionality
Score Tracking
Real-Time Updates
Color-Coded Interface
Responsive Design
No External Dependencies

๐Ÿ› Troubleshooting

Common Issues

Game won't start?

  • Ensure Python 3.8+ is installed
  • Check that tkinter is available: python -c "import tkinter"
  • Verify all files are in the same directory

AI too easy/hard?

  • The AI difficulty is set in the game engine
  • Easy: Random moves
  • Medium: Basic strategy
  • Hard: Optimal play

Performance issues?

  • The game uses minimal resources (<50MB RAM)
  • Close other applications if needed

๐Ÿค Contributing

Contributions welcome! Areas for improvement:

  • Enhanced graphics and animations
  • Online multiplayer support
  • Tournament mode
  • Custom board sizes
  • Advanced AI algorithms
  • Mobile app version

๐Ÿ“„ License

MIT License - Feel free to use, modify, and distribute!

๐ŸŽ‰ Credits

  • Game Design: Classic Connect Four rules
  • Modern UI: Clean, professional design
  • AI Algorithm: Minimax with alpha-beta pruning
  • Python Implementation: Optimized for performance and readability

๐Ÿค– Glimpse

image

Enjoy playing Modern Connect Four! ๐ŸŽฎโœจ

Built with โค๏ธ using Python and modern UI design principles

About

A beautiful, modern Connect Four game with AI opponent and engaging features.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages