(I hope is the good section?!)
I begin the scheme and I try to do a small MasterMind. But I can't structure correctly the programm and I'm not sure to understand the indent style and how use and change the variables.
I don't understand too what is the different between 'and' and 'and?'

And why 'not' is not 'not?'

Code: Select all
#lang racket
;; Master Mind ;;
(define nC 8)
(define lType [list nC nC nC nC])
(define nMyst (map (lambda (n) (random n)) lType))
(define (ask)
(let* ([i (read [current-input-port])])
(if (and (integer? i)
(>= i 0)
(< i nC)) i (begin [printf "You must write a number between 0 and ~a\n" (- nC 1)]
ask))
)
)
(define (L L1)
(let* ([ans (list (ask) (ask) (ask) (ask))])
(list
(map [lambda (a b) (if (equal? a b) 'T [if [ormap equal? (list a a a a) L1] 'B 'F])] ans L1)
ans)
)
)
(do ([nT 0 (+ nT 1)]
[iList (L nMyst) (append (L nMyst) iList)])
((equal? (second iList) nMyst) (printf "You win: ~a !!" nMyst))
(begin
(printf "Round n°~a, \nF => False \nB => Bad Position \nT => True \nIt is incorrect: \n" nT)
(for-each (lambda (arg) (printf "~a\n" arg)) iList)
)
)