This repository uses the pingv4 library for Connect Four gameplay.
# Fork this repo on GitHub (click the Fork button), then:
git clone https://github.com/YOUR_USERNAME/pingv4-competition
cd pingv4-competitionpip install pingv4# Copy the template
cp submissions/template_bot.py submissions/yourname_yournetid.pyEdit your bot file:
- Change
strategy_nameto describe your approach - Fill in your
author_nameandauthor_netid - Write your AI logic in the
get_move()method
IMPORTANT: Change the class name as your snu net id!
Edit main.py:
# Change this:
from submissions.template_bot import Bot
# To this (with your filename):
from submissions.yourname_yournetid import YourSNUNetID # For eg. DJ141Run the test:
python main.pygit add submissions/yourname_yournetid.py
git add main.py
git commit -m "Add [Your Name]'s bot: [Strategy Name]"
git push origin mainCreate a Pull Request on GitHub!
- Submit exactly ONE bot file in
submissions/ - Update the import in
main.pyto your bot - Change the class name to
your snu net id - Test locally before submitting
- Use only pingv4 library and Python standard library
- Modify other files
- Use external libraries or network calls
- Submit multiple bots in one PR
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_choiceYou 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()