Skip to content · ⁨Lompat ke konten⁩

Tic-tac-toe winner · ⁨Pemenang 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".

Bahasa Indonesia

Pemenang tic-tac-toe

Tentukan pemenang permainan noughts and crosses dari papan permainan.

Ada delapan garis yang perlu dicek: tiga baris, tiga kolom, dan dua diagonal. board[r][c] adalah kotak di baris r dan kolom c, jadi sebuah kolom adalah board[0][c] + board[1][c] + board[2][c]. Kumpulkan semua delapan garis sebagai string tiga huruf, lalu cari "XXX" atau "OOO".

Log in or create account · ⁨Masuk atau buat akun⁩

IGCSE, A-Level & AP