1; A GameType (GT) is one of:2; - "action"3; - "adventure"4; - "rpg"5; Interpretation: types of video games6 7(define GT-ACTION "action")8(define GT-ADVENTURE "adventure")9(define GT-RPG "rpg")10 11; A Game is a (make-game String GameType)12; Interpretation: a video game13; - name is the name of the game14; - type is the type of the game15(define-struct game [name type])16 17(define GAME-CYBER (make-game "Cyberpunk 2077" GT-ACTION))18(define GAME-ZELDA (make-game "Legend of Zelda" GT-ADVENTURE))19(define GAME-ELDEN (make-game "Elden Ring" GT-RPG))20 21; adventure-game? : Game -> Boolean22; Determines if the given game is an adventure game.23(define (adventure-game? game)24 (string=? (game-type game) GT-ADVENTURE))25 26(adventure-game? GAME-CYBER) ; #false27(adventure-game? GAME-ZELDA) ; #true28(adventure-game? GAME-ELDEN) ; #false
1#false2#true3#false