MCPcopy Create free account
hub / github.com/ndleah/python-mini-project / check_winner

Function check_winner

Connect-Four/main.py:32–38  ·  view source on GitHub ↗
(row, col)

Source from the content-addressed store, hash-verified

30 return None
31
32def check_winner(row, col):
33 directions = [(0, 1), (1, 0), (1, 1), (-1, 1)]
34 for dr, dc in directions:
35 count = 1 + check_line(row, col, dr, dc) + check_line(row, col, -dr, -dc)
36 if count >= 4:
37 return True
38 return False
39
40def check_line(row, col, delta_row, delta_col):
41 count = 0

Callers 1

drop_pieceFunction · 0.85

Calls 1

check_lineFunction · 0.85

Tested by

no test coverage detected