<commit_before>(ns zetawar.hex
  (:require
   [zetawar.util :refer [abs]]))

(def min-q 0)
(def min-r 0)

(def max-q 100)
(def max-r 100)

(defn east [q r]
  [(inc q) r])

(defn west [q r]
  [(dec q) r])

(defn northeast [q r]
  (if (= (mod r 2) 0)
    [q (dec r)]
    [(inc q) (dec r)]))

(defn northwest [q r]
  (if (= (mod r 2) 0)
    [(dec q) (dec r)]
    [q (dec r)]))

(defn southeast [q r]
  (if (= (mod r 2) 0)
    [q (inc r)]
    [(inc q) (inc r)]))

(defn southwest [q r]
  (if (= (mod q 2) 0)
    [(dec q) (inc r)]
    [q (inc r)]))

(def adjacents
  (memoize (fn adjacents [q r]
             [(east q r) (west q r)
              (northeast q r) (northwest q r)
              (southeast q r) (southwest q r)])))

(defn offset->cube [q r]
  (let [x (- q (/ (- r (mod r 2)) 2))
        z r
        y (- 0 x z)]
    [x y z]))

(defn distance [q1 r1 q2 r2]
  (let [[x1 y1 z1] (offset->cube q1 r1)
        [x2 y2 z2] (offset->cube q2 r2)]<commit_msg>Fixing southwest hex calculation<commit_after>(ns zetawar.hex
  (:require
   [zetawar.util :refer [abs]]))

(def min-q 0)
(def min-r 0)

(def max-q 100)
(def max-r 100)

(defn east [q r]
  [(inc q) r])

(defn west [q r]
  [(dec q) r])

(defn northeast [q r]
  (if (= (mod r 2) 0)
    [q (dec r)]
    [(inc q) (dec r)]))

(defn northwest [q r]
  (if (= (mod r 2) 0)
    [(dec q) (dec r)]
    [q (dec r)]))

(defn southeast [q r]
  (if (= (mod r 2) 0)
    [q (inc r)]
    [(inc q) (inc r)]))

(defn southwest [q r]
  (if (= (mod r 2) 0)
    [(dec q) (inc r)]
    [q (inc r)]))

(def adjacents
  (memoize (fn adjacents [q r]
             [(east q r) (west q r)
              (northeast q r) (northwest q r)
              (southeast q r) (southwest q r)])))

(defn offset->cube [q r]
  (let [x (- q (/ (- r (mod r 2)) 2))
        z r
        y (- 0 x z)]
    [x y z]))

(defn distance [q1 r1 q2 r2]
  (let [[x1 y1 z1] (offset->cube q1 r1)
        [x2 y2 z2] (offset->cube q2 r2)]
{'fraction_non_alphanumeric': 0.19989642672190575, 'fraction_numerical': 0.03417918177110305, 'mean_word_length': 2.0377358490566038, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4193820', 'n_tokens_mistral': 962, 'n_tokens_neox': 884, 'n_words': 324}