-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchat-results.txt
178 lines (140 loc) · 5.15 KB
/
chat-results.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
To incorporate the assumptions into the existing code, you can make the following changes:
1. Update the `Node` class in the `WorldModel` namespace to include a `Type` property for a game object, which can be an enum representing different types of objects.
```csharp
public enum NodeType
{
Scenery,
Moveable,
Takeable,
Container,
Supporter,
Character
}
public class Node
{
// Existing properties...
public NodeType Type { get; set; }
// Existing constructor...
}
```
2. Update the `ILocation` and `IThing` interfaces in the `StandardLibrary` namespace to include a `NodeType` property.
```csharp
public interface ILocation : IThing
{
// Existing properties...
NodeType NodeType { get; }
}
public interface IThing
{
// Existing properties...
NodeType NodeType { get; }
}
```
3. Update the `Location` and `Thing` classes in the `StandardLibrary` namespace to implement the `NodeType` property.
```csharp
public class Location : Thing, ILocation
{
// Existing constructor and properties...
public override NodeType NodeType { get; } = NodeType.Scenery;
}
public class Thing : IThing
{
// Existing constructor and properties...
public NodeType NodeType { get; set; } = NodeType.Scenery;
}
```
4. Update the `Core` class in the `StandardLibrary` namespace to allow adding game objects with different node types.
```csharp
public class Core
{
// Existing properties and constructor...
public Core AddObject(string id, string name, string description, NodeType nodeType = NodeType.Scenery)
{
var obj = new Thing(id, name, description);
obj.NodeType = nodeType;
_world.AddNode(obj.Id, obj);
return this;
}
// Existing methods...
}
```
5. Update the `Player` class in the `StandardLibrary` namespace to implement the `IPlayer` interface and add a `Location` property for the current location of the player.
```csharp
public class Player : Person, IPlayer
{
// Existing constructor...
public ILocation? CurrentLocation { get; set; }
}
```
6. Update the `Core` class in the `StandardLibrary` namespace to include methods for adding containers and supporters.
```csharp
public class Core
{
// Existing properties and constructor...
public Core AddContainer(string id, string name, string description)
{
var obj = new Thing(id, name, description);
obj.NodeType = NodeType.Container;
_world.AddNode(obj.Id, obj);
return this;
}
public Core AddSupporter(string id, string name, string description)
{
var obj = new Thing(id, name, description);
obj.NodeType = NodeType.Supporter;
_world.AddNode(obj.Id, obj);
return this;
}
// Existing methods...
}
```
7. Update the `Core` class in the `StandardLibrary` namespace to include methods for adding character objects.
```csharp
public class Core
{
// Existing properties and constructor...
public Core AddCharacter(string id, string name, string description, bool isPlayer = false)
{
var character = new Person(id, name, description);
if (isPlayer)
{
Player = character as IPlayer;
}
_world.AddNode(character.Id, character);
return this;
}
// Existing methods...
}
```
8. In the `MyStory` namespace, update the `TheHouse` class to incorporate the new features.
```csharp
public class TheHouse : IStory
{
// Existing properties and constructor...
public void InitializeWorld()
{
Core
.CreateLocation(LocationId.Kitchen, "Kitchen", "A clean and well-organized kitchen.")
.AddObject(Id.Couch, "couch", "A cozy couch.", NodeType.Supporter)
.AddContainer(Id.Cabinet, "cabinet", "A wooden cabinet.")
.AddCharacter(Id.Owner, "owner", "The owner of the house.", true)
.CreateLocation(LocationId.LivingRoom, "Living Room", "A cozy living room with a comfortable couch.", LocationId.Kitchen, Direction.West)
.CreateLocation(LocationId.FrontPorch, "Front Porch", "A small front porch with a wooden bench.", LocationId.LivingRoom, Direction.South)
.CreateLocation(LocationId.FrontYard, "Front Yard", "A well-maintained front yard with a beautiful garden.", LocationId.FrontPorch, Direction.Out);
// Connect the couch and cabinet to the living room
_world.ConnectNodes(Core.Player.Id, LocationId.LivingRoom, EdgeType.IsIn, "Player is in the living room");
_world.ConnectNodes(Id.Couch, LocationId.LivingRoom, EdgeType.IsOn, "Couch is on the living room floor");
_world.ConnectNodes(Id.Cabinet, LocationId.Kitchen, EdgeType.IsWithin, "Cabinet is within the kitchen");
}
}
```
These changes should allow you to incorporate the assumptions into your existing codebase and create an interactive story game with the desired features.
Note: The code provided assumes that you will add a new `Id` class in the `MyStory` namespace to hold the constants for the object and location IDs. You can do this as follows:
```csharp
public static class Id
{
public const string Couch = "couch";
public const string Cabinet = "cabinet";
public const string Owner = "owner";
}
```