<commit_before>(ns ^:shared sr-client.behavior
    (:require [clojure.string :as string]
              [io.pedestal.app.messages :as msg]
              [io.pedestal.app :as app]))


(def max-rpm 15000)
(def race-distance-meters 402)



(defn shift-gear-transform [{:keys [gear rpm speed distance]} _]
;  (.log js/console "PRINTING"  gear rpm old_value)
  {:gear ((fnil inc 0) gear)
   :rpm 0
   :speed speed
   :distance distance})

(defn publish-player [player]
  [{msg/type :swap msg/topic [:other-players] :value player}])

(defn swap-transform [_ message]
  (:value message))

;msg
;{msg/type :shift-gear msg/topic [:my-car :gear]}
(defn total-count [_ nums]
  (do
    ;(.log js/console "!!!!!!!!!!" nums)
    (count nums)))

(defn sum-all [_ nums] (apply + nums))

(defn merge-players [_ {:keys [me others]}]
  (assoc others "Me" me))

(defn inc-transform [old_value _]
  ((fnil inc 0) old_value))

(defn get-speed [old_value {:keys [gear rpm]}]
  (if (nil? old_value)
    8
    (+ old_value (* old_value 0.2 (- 1 (/ rpm max-rpm))))))

(defn get-rpm [old_value {:keys [gear time]}]
 (if (nil? old_value)
    100
    (let [new_value (+ old_value (* max-rpm 0.1))]
      (if (> new_value max-rpm)
        max-rpm
        new_value))))

(defn init-main [_]
  [[:transform-enable [:main :my-car]<commit_msg>limiting gear shifts to max-gear:5<commit_after>(ns ^:shared sr-client.behavior
    (:require [clojure.string :as string]
              [io.pedestal.app.messages :as msg]
              [io.pedestal.app :as app]))


(def max-rpm 15000)
(def race-distance-meters 402)
(def max-gear 5)

(defn shift-gear-transform [{:keys [gear rpm speed distance]} _]
  (let [new-gear ((fnil inc 0) gear)]
    {:gear (if (> new-gear max-gear) gear new-gear)
     :rpm 0
     :speed speed
     :distance distance}))

(defn publish-player [player]
  [{msg/type :swap msg/topic [:other-players] :value player}])

(defn swap-transform [_ message]
  (:value message))

(defn total-count [_ nums]
  (do
    ;(.log js/console "!!!!!!!!!!" nums)
    (count nums)))

(defn sum-all [_ nums] (apply + nums))

(defn merge-players [_ {:keys [me others]}]
  (assoc others "Me" me))

(defn inc-transform [old_value _]
  ((fnil inc 0) old_value))

(defn get-speed [old_value {:keys [gear rpm]}]
  (if (nil? old_value)
    8
    (+ old_value (* old_value 0.2 (- 1 (/ rpm max-rpm))))))

(defn get-rpm [old_value {:keys [gear time]}]
 (if (nil? old_value)
    100
    (let [new_value (+ old_value (* max-rpm 0.1))]
      (if (> new_value max-rpm)
        max-rpm
        new_value))))

(defn init-main [_]
  [[:transform-enable [:main :my-car]
{'fraction_non_alphanumeric': 0.17757367011098354, 'fraction_numerical': 0.016073478760045924, 'mean_word_length': 3.116535433070866, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '355681', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1000, 'n_words': 269}