lspector / Clojush

The Push programming language and the PushGP genetic programming system implemented in Clojure.
http://hampshire.edu/lspector/push.html
Eclipse Public License 1.0
330 stars 92 forks source link

winkler01.clj and fizz_buzz_plus.clj #273

Closed Vaguery closed 5 years ago

Vaguery commented 5 years ago

winkler01: (updated to use doubles rather than rational fitness scores)

;; This is code for running Tozier's variant on Winkler's Zeros-and-Ones puzzle:
;;   For any positive (non-zero) integer input, return a
;;   strictly positive integer which when multiplied by
;;   the input value produces a result which contains only
;;   the digits 0 and 1 (in base 10 notation)
;;
;; Input and output are given as integers using the integer stack.

fizz_buzz_plus:

;;;;;;;;;;;;
;; Given an :integer input argument, and two :integer constants i and j, produce
;; a :string which includes the first argument integer at the start. If the
;; first argument is divisible by either i or j, add a space, then append the
;; :string "fizz" if the input is divisible by i, and (:string) "buzz" if it
;; is divisible by j. In cases where it is divisible by both, produce
;; "fizzbuzz". Otherwise produce a string containing only the integer, and no
;; extra space.