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

Function drop_piece

Connect-Four/main.py:14–24  ·  view source on GitHub ↗
(col)

Source from the content-addressed store, hash-verified

12current_player = PLAYER_1
13
14def drop_piece(col):
15 global current_player
16 row = get_next_open_row(col)
17 if row is not None:
18 board[row][col] = current_player
19 draw_board()
20 if check_winner(row, col):
21 print(f"Player {current_player} wins!")
22 reset_board()
23 else:
24 current_player = 3 - current_player # Switch player
25
26def get_next_open_row(col):
27 for row in range(ROWS - 1, -1, -1):

Callers 1

main.pyFile · 0.85

Calls 4

get_next_open_rowFunction · 0.85
draw_boardFunction · 0.85
check_winnerFunction · 0.85
reset_boardFunction · 0.85

Tested by

no test coverage detected