kyu_5.tic_tac_toe_checker package

Submodules

kyu_5.tic_tac_toe_checker.checker module

kyu_5.tic_tac_toe_checker.checker.check_cols(board)[source]

Check board by column

Parameters

board – list

Returns

1, 2, or None

kyu_5.tic_tac_toe_checker.checker.check_diagonals(board)[source]

Check board by diagonal

Parameters

board – list

Returns

1, 2, or None

kyu_5.tic_tac_toe_checker.checker.check_rows(board: list)[source]

Check board by row

Parameters

board – list

Returns

1, 2, or None

kyu_5.tic_tac_toe_checker.checker.is_solved(board)[source]
Checks whether the board’s current state is solved:

-1 if the board is not yet finished (there are empty spots), 1 if “X” won, 2 if “O” won, 0 if it’s a cat’s game (i.e. a draw).

Parameters

board – list

Returns

-1, 0, 1, or 2

kyu_5.tic_tac_toe_checker.test_checker module

Testing is_solved function

class kyu_5.tic_tac_toe_checker.test_checker.IsSolvedTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Testing is_solved function

test_is_solved()[source]

Testing is_solved function

The function should return whether the board’s current state is solved.

We want our function to return:

-1 if the board is not yet finished (there are empty spots), 1 if “X” won, 2 if “O” won, 0 if it’s a cat’s game (i.e. a draw).

Module contents