MCPcopy Create free account
hub / github.com/geekcomputers/Python / random_place

Function random_place

Tic-Tac-Toe Games/tic-tac-toe4.py:41–46  ·  view source on GitHub ↗

Place player number randomly on an empty position.

(board: np.ndarray, player: int)

Source from the content-addressed store, hash-verified

39
40
41def random_place(board: np.ndarray, player: int) -> np.ndarray:
42 """Place player number randomly on an empty position."""
43 selection = possibilities(board)
44 current_loc = random.choice(selection)
45 board[current_loc] = player
46 return board
47
48
49def row_win(board: np.ndarray, player: int) -> bool:

Callers 1

play_gameFunction · 0.85

Calls 1

possibilitiesFunction · 0.85

Tested by

no test coverage detected