Skip to content

Instantly share code, notes, and snippets.

@tvirolai
Last active August 10, 2019 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tvirolai/08cb7e3b87e65dbfb91049f72ebe03a1 to your computer and use it in GitHub Desktop.
Save tvirolai/08cb7e3b87e65dbfb91049f72ebe03a1 to your computer and use it in GitHub Desktop.
(ns battleship.logic)
(defrecord Cell [x y clicked? ship?])
(defn make-grid []
"This initializes an empty grid. The grid is sized 10 x 10. Each cell stores
its coordinates, whether it has been clicked or not and if it contains a ship."
(vec (for [y (range 10)]
(vec (for [x (range 10)]
(->Cell x y false false))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment