Workshop › Connect Four › Step 24 of 38
When a disc lands, land asks wins4. If there is a line of four, that player is the winner and the line is kept;
otherwise the turn passes. Once there is a winner, play does nothing.
```js
let winner // 0 while playing, 1 or 2, or 'draw'
let line // the four winning cells
winner = 0
line = []
function play(col) {
if (winner || falling || dropRow(col) === -1) return
falling = null
const four = wins4(row, col)
if (four) {
winner = who
line = four
} else {
turn = 3 - turn
}
```winner is 0 while playing. 0 counts as false, so if (winner ...) in play means "the game is over".if ... else: a win sets winner and line, otherwise the turn passes.let turn write let winner and let line; in reset, under turn = 1, write winner = 0 and line = [].play, add winner || at the start of the check.land, replace turn = 3 - turn with the if ... else.Skills: Game states
← Four in a row? Circle the four →