Question: Please complete in F - Sharp. Run program to make sure it works before submitting Complete the text - based adventure game ( three parts
Please complete in FSharp. Run program to make sure it works before submitting
Complete the textbased adventure game three parts
Part : Data Model Design with Records and Discriminated Unions.
Model
TODO: implement all these records type:
let Details
let Item
let RoomId
discriminated unions
type Exit
let Exits
let Room
let Player
let World
Part : Initialize the game world
Initial World
TODO: creating the records based on the records type we created in the Model part by using the following information:
A key: Item type
Name: A shiny key
Description: This key looks like it could open a nearby door.
Five rooms, put them inside a list:
Five rooms: Room type
Center room:
Id: center
Details:
Name: "A central room"
Description: "You are standing in a central room with exits in all directions. A single brazier lights the room."
Items: empty
Exits:
North PassableExit You see a darkened passageway to the north.", RoomId "north
South PassableExit You see door to the south. A waft of cold air hits your face.", RoomId "south
East LockedExit You see a locked door to the east.", key, PassableExit You see an open door to the east.", RoomId "east
West PassableExit You see an intreresting room to the west.", RoomId "west
North room:
Id: north
Details:
Name: "A dark room"
Description: "You are standing in a very dark room. You hear the faint sound of rats scurry along the floor."
Items: empty
Exits:
North NoExit None
South PassableExit You see an dimly lit room to the south.", RoomId "center"
East NoExit None
West NoExit None
South room:
Id: sorth
Details:
Name: "A cold room"
Description: "You are standing in room that feels very cold. Your breath instantly turns into a white puff."
Items: empty
Exits:
North PassableExit You see an exit to the north. That room looks numch warmer.", RoomId "center"
South NoExit None
East NoExit None
West NoExit None
West room:
Id: west
Details:
Name: "A cozy room"
Description: "This room seems very cozy, as if someone had made a home here. Various personal belongings are strewn about."
Items: key
Exits:
North NoExit None
South NoExit None
East PassableExit You see a doorway back to the lit room.", RoomId "center"
West NoExit None
East room:
Id: east
Details:
Name: An open meadow"
Description: "You are in an open meadow. The sun is bright and it takes some time for your eyes to adjust."
Items: empty
Exits:
North NoExit None
South NoExit None
East NoExit None
West PassableExit You see stone doorway to the west. Why would you want to go back there?", RoomId "center"
A player: Player type
Details:
Name: "Luke"
Description: "Just your average adventurer."
Inventory: empty
Location: RoomId "center"
gameWorld includes a map of rooms and a playeryou need to convert the room list to room map
gameWorld: World type
Part : Defining a Logic Pipeline
Logic
TODO: according to the following function, design the proper functions.
Hints: you may need at lest more functions.
gameWorld
move south
describeCurrentRoom
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
