Blame


1 12687dd9 2023-08-04 jrmu ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 12687dd9 2023-08-04 jrmu ;; about the language level of this file in a form that our tools can easily process.
3 12687dd9 2023-08-04 jrmu #reader(lib "htdp-beginner-reader.ss" "lang")((modname Scheme) (read-case-sensitive #t) (teachpacks ((lib "convert.ss" "teachpack" "htdp") (lib "guess.ss" "teachpack" "htdp") (lib "master.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "convert.ss" "teachpack" "htdp") (lib "guess.ss" "teachpack" "htdp") (lib "master.ss" "teachpack" "htdp")))))
4 12687dd9 2023-08-04 jrmu ;; check-guess : symbol symbol symbol symbol -> symbol
5 12687dd9 2023-08-04 jrmu ;; Given guess1 and guess2, which are symbols representing the color of squares 1
6 12687dd9 2023-08-04 jrmu ;; and 2, respectively, the function lets you check if the guesses are the same
7 12687dd9 2023-08-04 jrmu ;; as target1 and target2.
8 12687dd9 2023-08-04 jrmu
9 12687dd9 2023-08-04 jrmu (define (check-guess guess1 guess2 target1 target2)
10 12687dd9 2023-08-04 jrmu (cond
11 12687dd9 2023-08-04 jrmu [(and
12 12687dd9 2023-08-04 jrmu (symbol=? guess1 target1)
13 12687dd9 2023-08-04 jrmu (symbol=? guess2 target2))
14 12687dd9 2023-08-04 jrmu 'Perfect]
15 12687dd9 2023-08-04 jrmu [(or
16 12687dd9 2023-08-04 jrmu (symbol=? guess1 target1)
17 12687dd9 2023-08-04 jrmu (symbol=? guess2 target2))
18 12687dd9 2023-08-04 jrmu 'OneColorAtCorrectPosition]
19 12687dd9 2023-08-04 jrmu [(or
20 12687dd9 2023-08-04 jrmu (symbol=? guess1 target2)
21 12687dd9 2023-08-04 jrmu (symbol=? guess2 target1))
22 12687dd9 2023-08-04 jrmu 'OneColorOccurs]
23 12687dd9 2023-08-04 jrmu [else 'NothingCorrect]))