如何使用结构创建函数来创建条件

发布于 2025-01-17 13:52:37 字数 954 浏览 2 评论 0原文

我正在尝试使用球拍和结构创建一个小游戏来创建一个讲故事的游戏。我已经定义了列表和我需要开始的结构,但我不知道如何放入函数中,因为函数何时运行后,它将允许用户输入与 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文