1

我正在为一堂课的球拍制作一个大型的拼图游戏。我仍在试图弄清楚球拍,所以我真的很挣扎。我应该打印出一个带有随机字母的 5x5 棋盘,然后我需要打印出一个包含棋盘字符的列表列表,供我的教练在他的播放器中使用。然而,当我打电话给教练员时,它正在生成一个新的角色列表。关于我可能做错了什么的任何想法?

创建我的列表:

(define alphabet (list  "B " "C " "D " "F " "G " "H " "J " "K " "L " "M " "N" "P " "R " "S " "T " "V " "W " "X " "Y " "Z "))
(define vowel (list "A " "E " "I " "O " "U "))

(define (pick-item alphabet)(list-ref alphabet (random(length alphabet))));;select element randomly from alphabet list
(define (pick-vowel vowel)(list-ref vowel (random(length vowel)))) ;;select element randomly from vowel list

(define (make-row alphabet) (list (pick-item alphabet)(pick-vowel vowel)(pick-item alphabet)(pick-vowel vowel)(pick-item alphabet))) ;;make a list of vowels and consonants

(define (make-board) (list (make-row alphabet) (make-row alphabet) (make-row alphabet) (make-row alphabet) (make-row alphabet))) ;;make a list of 5 lists for board

(define (instructors-player gameGrid) (make-board) )

画板并打电话给教练员

(define gameGrid(draw-board (make-board)))
(instructors-player gameGrid);;call for instructors input

我跑步时的球拍输出

4

1 回答 1

0

尝试这个:

(define a-board (make-board))      ; make a board
(draw-board a-board)               ; draw the board
(instructors-player a-board)       ; give a-board to the instructor's player

也许最后一行需要是:

(draw-board (instructors-player a-board))
于 2015-10-07T16:15:12.000 回答