( (defun make_clue (word guess) (assign (not_green_word not_green_guess green) (make_green (expand_word word) (expand_word guess)) yellow (make_yellow not_green_word not_green_guess) (- (merge_colors green yellow 0) 128) ) ) (defun expand_word word (list (substr word 0 1) (substr word 1 2) (substr word 2 3) (substr word 3 4) (substr word 4 5)) ) (defun make_green (word guess) (if (not word) (list 0 0 0) (assign (inner_not_green_word inner_not_green_guess inner_green) (make_green (r word) (r guess)) (if (= (f word) (f guess)) (list inner_not_green_word inner_not_green_guess (c 1 inner_green)) (list (c (f word) inner_not_green_word) (c (f guess) inner_not_green_guess) (c 0 inner_green)) ) ) ) ) (defun make_yellow (word guess) (if (not guess) 0 (if (is_yellow word (f guess)) (c 1 (make_yellow (elide_one word (f guess)) (r guess))) (c 0 (make_yellow word (r guess))) ) ) ) (defun elide_one (word letter) (if (= (f word) letter) (r word) (c (f word) (elide_one (r word) letter)) ) ) (defun is_yellow (word letter) (if (not word) 0 (if (= (f word) letter) 1 (is_yellow (r word) letter) ) ) ) (defun merge_colors (green yellow val) (if (not green) val (merge_colors (r green) &rest (if (f green) (list yellow (+ 2 (* 3 val))) (list (r yellow) (+ (f yellow) (* 3 val))) ) ) ) ) )