如何使用结构创建函数来创建条件
我正在尝试使用球拍和结构创建一个小游戏来创建一个讲故事的游戏。我已经定义了列表和我需要开始的结构,但我不知道如何放入函数中,因为函数何时运行后,它将允许用户输入与 A 或 B 相对应的参数,并根据选择打印列表 A 或 B
(define A '("Confidently stepped right in to solve the mystery atop Skelen Manor."))
(define b '( "Ran away due to my fear of death and the boredom of the paperwork after the matter"))
(define line1 '("Walking away from the police chatter, I approached the eery-looking Skelen Manor, a relic of an
;older generation; and as I opened the golden doors into the manor, I took a deep breath and"))
(define line2 '("You have failed the case, and let down the department... but worry not! Would you
;like to try again?"))
(define line3 '( "press no the game will CLOSE
or press Yes the game will restart from the Chapter 1 intro text as typed above"))
;we will use strucure to track the users choices
(struct choice1 ( A b))
(make-string string string)
(define first (choice1 A b))
(define (options choice1)
(
i am trying to create a little mini game using racket and structs to creating a story telling game.i have already defined lists and the struct i need to get going but i don't know how to put into a function,for when the function is ran it will allow the user input a parameter corresponding to A or B and depending on the choice it shall print lists A or B
(define A '("Confidently stepped right in to solve the mystery atop Skelen Manor."))
(define b '( "Ran away due to my fear of death and the boredom of the paperwork after the matter"))
(define line1 '("Walking away from the police chatter, I approached the eery-looking Skelen Manor, a relic of an
;older generation; and as I opened the golden doors into the manor, I took a deep breath and"))
(define line2 '("You have failed the case, and let down the department... but worry not! Would you
;like to try again?"))
(define line3 '( "press no the game will CLOSE
or press Yes the game will restart from the Chapter 1 intro text as typed above"))
;we will use strucure to track the users choices
(struct choice1 ( A b))
(make-string string string)
(define first (choice1 A b))
(define (options choice1)
(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论