<commit_before>(ns checkerboard.core
  (:require [quil.core :as q]
            [quil.middleware :as m]))

(defn setup []
  {:color 0
   :angle 0})

(defn update [state]
  ; Update sketch state by changing circle color and position.
  {:color (mod (+ (:color state) 0.7) 255)
   :angle (+ (:angle state) 0.1)})

(defn draw [state]
  ; Clear the sketch by filling it with light-grey color.
  (q/background 240)
  ; Set circle color.
  (q/fill (:color state) 255 255)
  ; Calculate x and y coordinates of the circle.
  (let [angle (:angle state)
        x (* 150 (q/cos angle))
        y (* 150 (q/sin angle))]
    ; Move origin point to the center of the sketch.
    (q/with-translation [(/ (q/width) 2)
                         (/ (q/height) 2)]
      ; Draw the circle.
      (q/ellipse x y 100 100))))

(q/defsketch checkerboard
  :title "You spin my circle right round"
  :size [500 500]
  ; setup function called only once, during sketch initialization.
  :setup setup
  ; update is called on each iteration before draw is called.
  ; It updates sketch state.
  :update update
  :draw draw
  ; This sketch uses functional-mode middleware.
  ; Check quil wiki for more info about middlewares and particularly
  ; fun-mode.
  :middleware [m/fun-mode])<commit_msg>Add checkerboard sketch.<commit_after>(ns checkerboard.core
  (:require [quil.core :as q]
            [quil.middleware :as m]))

(def WIDTH 500)
(def HEIGHT 500)

(def ROWS 10)
(def COLS 10)

(defn setup []
  {})

(defn update [state]
  state)

(defn draw [state]
  ; Clear the sketch by filling it with black color.
  (q/background 0)
  ; Set color.
  (q/fill 255)
  (let [col-width (/ WIDTH (float COLS))
        row-height (/ HEIGHT (float ROWS))]
    (doseq [row (range 0 ROWS)
            col (range 0 COLS)
            :when (or (and (even? row) (even? col))
                      (and (odd? row) (odd? col)))
            :let [x (* col-width col)
                  y (* row-height row)]]
      (q/rect x y col-width row-height)))
  )

(q/defsketch checkerboard
  :title "Checkerboard"
  :size [WIDTH HEIGHT]
  ; setup function called only once, during sketch initialization.
  :setup setup
  ; update is called on each iteration before draw is called.
  ; It updates sketch state.
  :update update
  :draw draw
  ; This sketch uses functional-mode middleware.
  ; Check quil wiki for more info about middlewares and particularly
  ; fun-mode.
  :middleware [m/fun-mode])
{'fraction_non_alphanumeric': 0.11716509627201967, 'fraction_numerical': 0.02212208111429742, 'mean_word_length': 2.617777777777778, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1448586', 'n_tokens_mistral': 857, 'n_tokens_neox': 786, 'n_words': 300}