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

Function is_space_free

Tic-Tac-Toe Games/tic-tac-toe5.py:99–108  ·  view source on GitHub ↗

Return True if a position on the board is free. >>> is_space_free([' ', 'X',' ',' ',' ',' ',' ',' ',' ',' '], 1) False >>> is_space_free([' ']*10, 5) True

(board: List[str], move: int)

Source from the content-addressed store, hash-verified

97
98
99def is_space_free(board: List[str], move: int) -> bool:
100 """
101 Return True if a position on the board is free.
102
103 >>> is_space_free([' ', 'X',' ',' ',' ',' ',' ',' ',' ',' '], 1)
104 False
105 >>> is_space_free([' ']*10, 5)
106 True
107 """
108 return board[move] == " "
109
110
111def get_player_move(board: List[str]) -> int:

Callers 4

get_player_moveFunction · 0.85
get_computer_moveFunction · 0.85
is_board_fullFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected