Gomoku (오목) in the browser. Play the computer, pass the device back and forth, or invite a friend to an online room. Plain HTML, CSS and JavaScript with no build step.
Play in your browser: https://jayyo.github.io/gomoku/
- Computer opponent with three levels. It runs in the browser, so it works offline, and it thinks in a Web Worker so the page stays responsive (on
file://, where workers are blocked, it falls back to the main thread). - Freestyle and Renju rules. Under Renju, Black's forbidden points (double three, double four, overline) are marked on the board and can't be played. The check follows the RIF definitions, including split shapes like
●·●●and threes that only look open. - Two players on one device, with undo.
- Online rooms on Supabase: room codes and invite links, an optional bet, taunts the winner can send after the game, rematches with colors swapped, and a Hall of Fame with move-by-move replays.
- English and Korean UI, keyboard play (arrow keys and Enter), sound effects synthesized with the Web Audio API.
I started it in February 2026 wanting a gomoku game two friends could start by sharing a code, with nothing to install. I later added online rooms on Supabase and a pass-and-play mode after deciding the first design was bland; it's also why I bought my first domain.
This is a side project. The Supabase project behind online play is currently paused, so the lobby says online rooms are unavailable. Playing the computer and pass-and-play don't need a server and work fully.
Serve the folder with any static file server:
python3 -m http.server 8000
# then open http://localhost:8000Opening index.html straight from disk also works, but browsers don't allow Web Workers on file://, so the computer then thinks on the main thread.
Tests cover the rules and the computer player and need Node 18 or newer, nothing else:
node --testPushing to master runs the tests and publishes the site files to GitHub Pages (.github/workflows/pages.yml). GitHub Pages can't send response headers, so the Content-Security-Policy is a <meta> tag in each page; vercel.json only adds the headers a meta tag can't express.
- Create a Supabase project and run
setup.sqlin its SQL editor. It is safe to run again, but it is written for a new project: tables left over from earlier versions of this repo have a different shape and should be dropped first. - Put the project URL and its publishable (anon) key in
js/config.js.
The publishable key is meant to be public. There are no accounts, so what it can do is limited by the database instead: room codes and names have a fixed format, moves must alternate colors in order with one stone per point, a trigger only allows rooms to go waiting → playing → finished, and a Hall of Fame entry can only be deleted with the token its winner received. That keeps the data consistent, but a modified client could still play for the other side or ignore Renju rules, since wins and forbidden moves are checked in the browser. It's fine for playing with friends, not for anything with stakes.
Every candidate point near the stones gets a score from the shapes it makes along its four lines, for both sides (a five, an open four, a four, an open three and so on, classified from an 11-cell window and cached). Before falling back to that score, the engine:
- takes a five, or blocks the opponent's five;
- looks for a forced win made only of fours (VCF);
- on Hard, also looks for forced wins that use threes (VCT);
- if the opponent threatens an open four or another double threat, only considers moves that stop it.
Hard also skips moves that leave the opponent a VCF, then runs an alpha-beta search over its ten best moves, going deeper in steps (up to six plies) until its 1.5 seconds per move run out. Easy skips the searches, sometimes ignores open threes and picks among its top few moves. In 120 self-play games against Normal from random four-stone openings (both colors, both rule sets), Hard won 106, lost 12 and drew 2. Against the previous Hard, which had no alpha-beta search, it won 70, lost 19 and drew 7 of 96 games set up the same way. Normal won 39 of 40 games against Easy, with one draw. Under Renju the engine never plays a forbidden point as Black, and as White it doesn't waste moves blocking points Black isn't allowed to use.
| Path | |
|---|---|
js/rules.js |
Win check and Renju forbidden moves. No DOM, shared by the page, the worker and the tests |
js/ai.js, js/ai-worker.js |
Computer player |
js/local-game.js |
Games against the computer and on one device |
js/game.js |
Online rooms |
js/lobby.js, js/hall.js |
Lobby and Hall of Fame |
setup.sql |
Database tables, constraints and row level security |
tests/ |
node --test suites |
- Renju is played with a free opening. Tournament opening rules (Soosõrv-8, Taraguchi and others) aren't implemented, and a forbidden point is simply not playable instead of losing the game.
- The search looks at ten moves per position and six plies at most, with a simple shape count as its evaluation and no transposition table, so an experienced player will still find its weak spots.
- Online rooms have no accounts, see above.
브라우저에서 두는 오목입니다. 컴퓨터와 두거나, 한 기기에서 둘이 번갈아 두거나, 방 코드로 친구를 불러 온라인으로 둘 수 있습니다. 빌드 과정 없이 HTML, CSS, JavaScript로만 만들었습니다. 브라우저에서 바로 둘 수 있습니다: https://jayyo.github.io/gomoku/
2026년 2월, 친구끼리 코드만 공유하면 설치 없이 바로 둘 수 있는 오목을 원해서 시작했습니다. 이후 Supabase 온라인 방과 한 기기에서 번갈아 두는 모드를 붙였고, 이 게임 때문에 처음으로 도메인도 샀습니다.
- 컴퓨터 상대는 쉬움, 보통, 어려움 세 단계이고 Web Worker에서 돌아가서 인터넷 없이도 됩니다.
- 자유룰과 렌주룰을 지원합니다. 렌주룰에서는 흑의 금수(삼삼, 사사, 장목)를 국제렌주연맹(RIF) 정의대로 판정하고 판 위에 ✕로 표시합니다.
- 온라인 대국은 Supabase를 씁니다. 지금은 Supabase 프로젝트가 일시 중지되어 있어 온라인 방은 쓸 수 없다고 안내되고, 컴퓨터 대국과 한 화면 2인 대국은 그대로 됩니다.
- 실행은
python3 -m http.server 8000같은 정적 서버로 폴더를 열면 되고, 테스트는node --test입니다.


