球拍博格格游戏

时间:2015-10-07 15:51:34

标签: racket boggle

我正在为一堂课练习一个大型的boggle游戏。我仍在努力弄清楚球拍,所以我真的很挣扎。我应该在其中打印出一个带有随机字母的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

Racket output when I run

1 个答案:

答案 0 :(得分: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))