documentation fixes

This commit is contained in:
2025-04-25 22:40:51 -04:00
parent cbe69e2fbb
commit 53ce0db3ba

View File

@@ -26,14 +26,14 @@
(defvar cube-faces "UDLRFB") (defvar cube-faces "UDLRFB")
(defun cube-scramble (moves) (defun cube-scramble (moves)
"Generates a list of random scramnles for a 3x3 Rubik's cube and displays it. "Generate a list of random moves for a 3x3 Rubik's cube and display it
MOVES represents the number of moves in the list." MOVES represents the number of moves in the list."
(interactive "p") (interactive "p")
(message (mapconcat 'identity (cube-build-scramble moves) " "))) (message (mapconcat 'identity (cube-build-scramble moves) " ")))
(defun cube-build-scramble (moves) (defun cube-build-scramble (moves)
"Generates a list of random moves for a 3x3 Rubik's cube "Generate a list of random moves for a 3x3 Rubik's cube
MOVES os the number of moves to generate. The algorithm will not MOVES os the number of moves to generate. The algorithm will not
generate a sequence that moves the same face twice in a row." generate a sequence that moves the same face twice in a row."
@@ -45,14 +45,14 @@ generate a sequence that moves the same face twice in a row."
result)) result))
(defun cube-random-face (&optional last-face) (defun cube-random-face (&optional last-face)
"Generates a random cube face "Generate a random cube face
If supplied, LAST-FACE will be excluded as a possibility." If supplied, LAST-FACE will be excluded as a possibility."
(let ((faces (cube-filter cube-faces last-face))) (let ((faces (cube-filter cube-faces last-face)))
(elt faces (random (length faces))))) (elt faces (random (length faces)))))
(defun cube-random-turn (face) (defun cube-random-turn (face)
"Generates a random turn directio for a given face "Generate a random turn direction for a given face
FACE is a character representing the face to be turned." FACE is a character representing the face to be turned."
(let ((suffix (pcase (random 3) (let ((suffix (pcase (random 3)
@@ -61,8 +61,8 @@ FACE is a character representing the face to be turned."
(2 "2")))) (2 "2"))))
(format "%c%s" face suffix))) (format "%c%s" face suffix)))
(defun cube-filter (str char) (defun cube-filter (sequence value)
"Filters all instances of a character from a string" "Filter all instances of a value from a sequence"
(seq-filter (lambda (c) (not (equal c char))) str)) (seq-filter (lambda (c) (not (equal c value))) sequence))
;;; cube-scrambler.el ends here ;;; cube-scrambler.el ends here