<commit_before>(in-package :clobber)

;;; TODO: 
;;; [ ]  Add slot to player class that tells us which level the
;;;      player is currently on. (layer?)
;;;
;;; [ ]  Add slot to items which can be used to map them to a fixnum (integer)
;;;
;;; [ ]  Add function to write out the world so it can persist


(defparameter *layer-0* (make-array '(10 10)
                                    :initial-contents '((0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 1 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)))
  "The grassy knoll where player starts")

(defparameter *layer-1* (make-array '(10 10)
                                    :initial-contents '((2 2 2 2 2 2 2 2 2 2)
                                                        (2 2 2 2 2 2 2 2 2 2)
                                                        (2 2 2 2 2 2 2 2 2 2)
                                                        (2 2 2 2 2 2 3 3 2 2)
                                                        (2 2 2 2 2 2 3 3 2 2)
                                                        (2 2 2 2 2 2 2 2 2 2)
                                                        (2 2 2 2 2 2 2 2 2 2)
                                                        (2 2 2 2 2 2 2 2 2 2)
                                                        (2 2 2 2 2 2 2 2 2 2)
                                                        (2 2 2 2 2 2 2 2 2 2)))
  "The grassy floor beneath the player where she starts")

(defparameter *world* (list *layer-0* *layer-1*)
  "The *world* is a list made of 10x10 layers")

(defun add-layer ()
  (push (make-array '(10 10)) *world*))

(defun reset-world ()
  (setf *layer-0* (make-array '(10 10) :initial-element 0))
  (setf (aref *layer-0* 5 5) 1)
  (setf *world* (list *layer-0* *layer-1*)))

(defun value-at (x y)
  (aref (layer-under-player) y x))

(defun layer-value-at (layer x y)
  (aref layer y x))

(defun layer-under-player ()
  (nth (+ (layer *player*) 1) *world*))

(defun layer-at-player ()
  (nth (layer *player*) *world*))

(defun layer-above-player ()
  (nth (- (layer *player*) 1) *world*))

(defgeneric move (layer obj nx ny)
  (:method (layer (obj player) nx ny)
    (setf (aref (nth layer *world*) (x-pos obj) (y-pos obj)) 0)
    (setf (x-pos obj) nx)
    (setf (y-pos obj) ny)
    (setf (aref (nth layer *world*) nx ny) 1)))


; brainstorming
;
;(defgeneric dig (tool object)
;  (:documentation "The dig function decides the outcome of using a certain tool on an object")
;  (:method ((tool shovel) (object earth))
;    (create 'dirt)))<commit_msg>Changed argument in defgenric move from (obj player) to (player player)<commit_after>(in-package :clobber)

;;; TODO: 
;;; [ ]  Add slot to player class that tells us which level the
;;;      player is currently on. (layer?)
;;;
;;; [ ]  Add slot to items which can be used to map them to a fixnum (integer)
;;;
;;; [ ]  Add function to write out the world so it can persist


(defparameter *layer-0* (make-array '(10 10)
                                    :initial-contents '((0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 1 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)
                                                        (0 0 0 0 0 0 0 0 0 0)))
  "The grassy knoll where player starts")

(defparameter *layer-1* (make-array '(10 10)
                                    :initial-contents '((2 2 2 2 2 2 2 2 2 2)
                                                        (2 2 2 2 2 2 2 2 2 2)
                                                        (2 2 2 2 2 2 2 2 2 2)
                                                        (2 2 2 2 2 2 3 3 2 2)
                                                        (2 2 2 2 2 2 3 3 2 2)
                                                        (2 2 2 2 2 2 2 2 2 2)
                                                        (2 2 2 2 2 2 2 2 2 2)
                                                        (2 2 2 2 2 2 2 2 2 2)
                                                        (2 2 2 2 2 2 2 2 2 2)
                                                        (2 2 2 2 2 2 2 2 2 2)))
  "The grassy floor beneath the player where she starts")

(defparameter *world* (list *layer-0* *layer-1*)
  "The *world* is a list made of 10x10 layers")

(defun add-layer ()
  (push (make-array '(10 10)) *world*))

(defun reset-world ()
  (setf *layer-0* (make-array '(10 10) :initial-element 0))
  (setf (aref *layer-0* 5 5) 1)
  (setf *world* (list *layer-0* *layer-1*)))

(defun value-at (x y)
  (aref (layer-under-player) y x))

(defun layer-value-at (layer x y)
  (aref layer y x))

(defun layer-under-player ()
  (nth (+ (layer *player*) 1) *world*))

(defun layer-at-player ()
  (nth (layer *player*) *world*))

(defun layer-above-player ()
  (nth (- (layer *player*) 1) *world*))

(defgeneric move (layer obj nx ny)
  (:method (layer (player player) nx ny)
    (setf (aref (nth layer *world*) (x-pos player) (y-pos player)) 0)
    (setf (x-pos player) nx)
    (setf (y-pos player) ny)
    (setf (aref (nth layer *world*) nx ny) 1)))


; brainstorming
;
;(defgeneric dig (tool object)
;  (:documentation "The dig function decides the outcome of using a certain tool on an object")
;  (:method ((tool shovel) (object earth))
;    (create 'dirt)))
{'fraction_non_alphanumeric': 0.10148786217697729, 'fraction_numerical': 0.07392325763508223, 'mean_word_length': 0.958295001533272, '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': 152, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5776271', 'n_tokens_mistral': 2187, 'n_tokens_neox': 1755, 'n_words': 839}