Skip to content

dscsnu/pingv4-repo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pingv4 repo!

This repository uses the pingv4 library for Connect Four gameplay.


Instructions

1. Fork and Clone

# Fork this repo on GitHub (click the Fork button), then:
git clone https://github.com/YOUR_USERNAME/pingv4-competition
cd pingv4-competition

2. Install pingv4

pip install pingv4

3. Create Your Bot

# Copy the template
cp submissions/template_bot.py submissions/yourname_yournetid.py

Edit your bot file:

  • Change strategy_name to describe your approach
  • Fill in your author_name and author_netid
  • Write your AI logic in the get_move() method

IMPORTANT: Change the class name as your snu net id!

4. Test Your Bot

Edit main.py:

# Change this:
from submissions.template_bot import Bot

# To this (with your filename):
from submissions.yourname_yournetid import YourSNUNetID # For eg. DJ141

Run the test:

python main.py

5. Submit

git add submissions/yourname_yournetid.py
git add main.py
git commit -m "Add [Your Name]'s bot: [Strategy Name]"
git push origin main

Create a Pull Request on GitHub!


Submission Rules

DO:

  • Submit exactly ONE bot file in submissions/
  • Update the import in main.py to your bot
  • Change the class name to your snu net id
  • Test locally before submitting
  • Use only pingv4 library and Python standard library

DON'T:

  • Modify other files
  • Use external libraries or network calls
  • Submit multiple bots in one PR

Bot Development Guide

Available Board Methods

def get_move(self, board: ConnectFourBoard) -> int:
    # Get valid moves
    valid_moves = board.get_valid_moves()  # Returns list like [0,1,2,3,4,5,6]
    
    # Check whose turn it is
    my_color = board.current_player  # CellState.Red or CellState.Yellow
    
    # Access cells (column, row indexing)
    cell = board[3, 0]  # Bottom of center column
    
    # Simulate future moves
    future_board = board.make_move(3)
    if future_board.is_victory:
        return 3  # Winning move!
    
    # Check column heights
    heights = board.column_heights  # [2, 3, 1, 4, 2, 0, 1]
    
    # Get game state
    board.is_in_progress  # True if game ongoing
    board.winner          # CellState.Red, CellState.Yellow, or None
    
    return your_column_choice

Testing Against Other Bots

You can test your bot against others by editing main.py:

# Test against built-in MinimaxBot
from pingv4 import MinimaxBot
game = Connect4Game(player1=Bot, player2=MinimaxBot)
game.run()

Resources


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages