Compare commits
3 Commits
0d78812870
...
v0.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ba21295ab | |||
| 2fd1a551be | |||
| 78268d78da |
@@ -3,7 +3,7 @@
|
|||||||
;; Copyright (C) Jonathan Lamothe
|
;; Copyright (C) Jonathan Lamothe
|
||||||
|
|
||||||
;; Author: Jonathan Lamothe <jonathan@jlamothe.net>
|
;; Author: Jonathan Lamothe <jonathan@jlamothe.net>
|
||||||
;; Package-Version: 0.1
|
;; Package-Version: 0.1.1
|
||||||
|
|
||||||
;; This file is not part of GNU Emacs.
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
@@ -35,13 +35,13 @@ MOVES represents the number of moves in the list."
|
|||||||
(defun cube-build-scramble (moves)
|
(defun cube-build-scramble (moves)
|
||||||
"Generate 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 is 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."
|
||||||
(let (result last-face)
|
(let (result last-face)
|
||||||
(while (> moves 0)
|
(while (> moves 0)
|
||||||
(setq last-face (cube-random-face last-face))
|
(setq last-face (cube-random-face last-face))
|
||||||
(push (cube-random-turn last-face) result)
|
(push (cube-random-turn last-face) result)
|
||||||
(setq moves (1- moves )))
|
(setq moves (1- moves)))
|
||||||
result))
|
result))
|
||||||
|
|
||||||
(defun cube-random-face (&optional last-face)
|
(defun cube-random-face (&optional last-face)
|
||||||
|
|||||||
Reference in New Issue
Block a user