Skip to content · ⁨コンテンツへスキップ⁩

Tic-tac-toe winner · ⁨ tic-tac-toe の勝者判定⁩

English

Tic-tac-toe winner

Decide a game of noughts and crosses from the board.

There are eight lines to check: three rows, three columns and two diagonals. board[r][c] is the square in row r and column c, so a column is board[0][c] + board[1][c] + board[2][c]. Collect all eight lines as three-letter strings, then look for "XXX" or "OOO".

日本語

タックタックトゥーの勝者判定

ボードを見てオタOXゲームの勝者を決定します。

確認すべき8つのラインがあります:3つの行、3つの列、2つの対角線です。board[r][c] は行 r と列 c のマス目なので、列は board[0][c] + board[1][c] + board[2][c] です。8つのラインをすべて3文字の文字列として収集し、"XXX" または "OOO" を探します。

Log in or create account · ⁨ログインまたはアカウント作成⁩

IGCSE, A-Level & AP