Function: 5x5-mutate-solution

5x5-mutate-solution is a byte-compiled function defined in 5x5.el.gz.

Signature

(5x5-mutate-solution SOLUTION)

Documentation

Randomly flip bits in the solution.

Source Code

;; Defined in /usr/src/emacs/lisp/play/5x5.el.gz
(defun 5x5-mutate-solution (solution)
  "Randomly flip bits in the solution."
  (dotimes (y 5x5-grid-size)
    (dotimes (x 5x5-grid-size)
      (if (= (random (/ (* 5x5-grid-size 5x5-grid-size) 2))
             (/ (/ (* 5x5-grid-size 5x5-grid-size) 2) 2))
          (5x5-flip-cell solution y x))))
  solution)