Skip to content

Instantly share code, notes, and snippets.

View baz44's full-sized avatar
🏠
Working from home

Basel Farah baz44

🏠
Working from home
View GitHub Profile
@baz44
baz44 / core.clj
Last active September 16, 2024 05:36
tic-tac-toe
(ns tic-tac-toe.core)
(def board-size 3)
(defn winner [board]
"It takes a board and checks for a winner, returns nil if no winner is found"
(let [rows board
columns (apply mapv vector board)
diagonal (mapv #(get-in board [% %]) (range board-size))
anti-diagonal (mapv #(get-in board [% (- (dec board-size) %)]) (range board-size))]

Keybase proof

I hereby claim:

  • I am baz44 on github.
  • I am baself (https://keybase.io/baself) on keybase.
  • I have a public key whose fingerprint is E379 526D EBD7 CDE2 EAD0 E354 BB62 0AA1 0665 7FCE

To claim this, I am signing this object: