lab_tic_tac_toe/assessment.md

660 B

Tic Tac Toe Lab Assessment

Everything's done--nice work!

Checkpoint 1

Looks good.

Checkpoint 2

Works! I don't think there's a much more elegant way to do this, although I might have chosen to separate out the data (row/col/diagonal indices) from the looping structure. If you wanted to get fancy, you could do this (prob some constructs here you haven't seen, but might find interesting). Ask me if you can't figure out what's going on :)

combos = [
    [0, 3, 6],
    [1, 4, 7],
    ...
]
is_symbol = lambda index: state['board'][index] == symbol
return any(all(map(is_symbol, combo)) for combo in combos)

Checkpoint 3

Looks good.