Skip to content

Latest commit

 

History

130 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clojure Tic-Tac-Toe

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.

Features

  • 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 .cljc and shared across JVM and JavaScript

Prerequisites

Running the Game

clojure -M:run

Browser Version

# Compile ClojureScript
clojure -M:cljs

Then open the compiled app in a browser.

Building a JAR

clojure -T:build jar

This produces target/TicTacToe.jar, a source JAR containing all .clj and .cljc files. Used by clojure-server as a local dependency.

Running Tests

Backend:

clj -M:test:spec

Frontend:

clj -M:test:cljs

AI

Difficulty Strategy
Easy Random moves
Medium Wins if possible, blocks opponent, otherwise random
Hard Minimax with memoization (depth-limited on larger boards)

Tech Stack

  • Clojure 1.10+ / ClojureScript 1.11
  • Quil -- Desktop graphics (Processing wrapper)
  • Reagent -- ClojureScript React wrapper
  • next.jdbc -- Database access
  • SpeclJ -- Testing framework

About

A tic-tac-toe game built in Clojure and ClojureScript, playable via terminal, desktop GUI, or web browser.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages