A tic-tac-toe game built in Clojure and ClojureScript, playable via terminal, desktop GUI, or web browser. Supports multiple board sizes (3x3, 4x4, and 3D 3x3x3) with three AI difficulty levels.
- Three UIs -- Terminal (TUI), desktop graphics (Quil), and browser (Reagent/React)
- Board sizes -- 3x3, 4x4, and 3x3x3 (3D, TUI only)
- AI difficulty -- Easy (random), Medium (basic strategy), Hard (minimax)
- Game persistence -- Save/load games via EDN files or PostgreSQL
- Replay -- Replay any previously stored game
- Shared logic -- Core game rules written in
.cljcand shared across JVM and JavaScript
- Java (JDK 8+)
- Clojure
- PostgreSQL (optional, for database persistence)
clojure -M:run# Compile ClojureScript
clojure -M:cljsThen open the compiled app in a browser.
clojure -T:build jarThis produces target/TicTacToe.jar, a source JAR containing all .clj and .cljc files. Used by clojure-server as a local dependency.
Backend:
clj -M:test:specFrontend:
clj -M:test:cljs| Difficulty | Strategy |
|---|---|
| Easy | Random moves |
| Medium | Wins if possible, blocks opponent, otherwise random |
| Hard | Minimax with memoization (depth-limited on larger boards) |
- Clojure 1.10+ / ClojureScript 1.11
- Quil -- Desktop graphics (Processing wrapper)
- Reagent -- ClojureScript React wrapper
- next.jdbc -- Database access
- SpeclJ -- Testing framework